allura
Revisão | 827559e6dd70da01095e3e7d814892f3f505bab1 (tree) |
---|---|
Hora | 2012-05-04 02:22:14 |
Autor | Dave Brondsema <dbrondsema@geek...> |
Commiter | Yaroslav Luzin |
[#4103] set c.user in @td.with_user_project; other test fixes
@@ -11,6 +11,7 @@ def with_user_project(username): | ||
11 | 11 | @wraps(func) |
12 | 12 | def wrapped(*args, **kw): |
13 | 13 | user = M.User.by_username(username) |
14 | + c.user = user | |
14 | 15 | n = M.Neighborhood.query.get(name='Users') |
15 | 16 | shortname = 'u/' + username |
16 | 17 | p = M.Project.query.get(shortname=shortname, neighborhood_id=n._id) |
@@ -36,11 +36,10 @@ class TestAuth(TestController): | ||
36 | 36 | |
37 | 37 | @td.with_user_project('test-admin') |
38 | 38 | def test_prefs(self): |
39 | - r = self.app.get('/auth/prefs/') | |
39 | + r = self.app.get('/auth/prefs/', extra_environ=dict(username='test-admin')) | |
40 | 40 | assert 'test@example.com' not in r |
41 | - mailboxes = M.Mailbox.query.find(dict(user_id=c.user._id, is_flash=False)) | |
41 | + subscriptions = M.Mailbox.query.find(dict(user_id=c.user._id, is_flash=False)).all() | |
42 | 42 | # make sure page actually lists all the user's subscriptions |
43 | - subscriptions = list(mailboxes.ming_cursor) | |
44 | 43 | assert len(subscriptions) > 0, 'Test user has no subscriptions, cannot verify that they are shown' |
45 | 44 | for m in subscriptions: |
46 | 45 | assert m._id in r, "Page doesn't list subscription for Mailbox._id = %s" % m._id |
@@ -48,8 +47,9 @@ class TestAuth(TestController): | ||
48 | 47 | 'display_name':'Test Admin', |
49 | 48 | 'new_addr.addr':'test@example.com', |
50 | 49 | 'new_addr.claim':'Claim Address', |
51 | - 'primary_addr':'Beta@wiki.test.projects.sourceforge.net', | |
52 | - 'preferences.email_format':'plain'}) | |
50 | + 'primary_addr':'test-admin@users.localhost', | |
51 | + 'preferences.email_format':'plain'}, | |
52 | + extra_environ=dict(username='test-admin')) | |
53 | 53 | r = self.app.get('/auth/prefs/') |
54 | 54 | assert 'test@example.com' in r |
55 | 55 | r = self.app.post('/auth/prefs/update', params={ |
@@ -58,19 +58,21 @@ class TestAuth(TestController): | ||
58 | 58 | 'addr-2.ord':'1', |
59 | 59 | 'addr-2.delete':'on', |
60 | 60 | 'new_addr.addr':'', |
61 | - 'primary_addr':'Beta@wiki.test.projects.sourceforge.net', | |
62 | - 'preferences.email_format':'plain'}) | |
61 | + 'primary_addr':'test-admin@users.localhost', | |
62 | + 'preferences.email_format':'plain'}, | |
63 | + extra_environ=dict(username='test-admin')) | |
63 | 64 | r = self.app.get('/auth/prefs/') |
64 | 65 | assert 'test@example.com' not in r |
65 | - ea = M.EmailAddress.query.get(_id='Beta@wiki.test.projects.sourceforge.net') | |
66 | + ea = M.EmailAddress.query.get(_id='test-admin@users.localhost') | |
66 | 67 | ea.confirmed = True |
67 | 68 | ThreadLocalORMSession.flush_all() |
68 | 69 | r = self.app.post('/auth/prefs/update', params={ |
69 | 70 | 'display_name':'Test Admin', |
70 | - 'new_addr.addr':'Beta@wiki.test.projects.sourceforge.net', | |
71 | + 'new_addr.addr':'test-admin@users.localhost', | |
71 | 72 | 'new_addr.claim':'Claim Address', |
72 | - 'primary_addr':'Beta@wiki.test.projects.sourceforge.net', | |
73 | - 'preferences.email_format':'plain'}) | |
73 | + 'primary_addr':'test-admin@users.localhost', | |
74 | + 'preferences.email_format':'plain'}, | |
75 | + extra_environ=dict(username='test-admin')) | |
74 | 76 | |
75 | 77 | def test_api_key(self): |
76 | 78 | r = self.app.get('/auth/prefs/') |