• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

allura


Commit MetaInfo

Revisão827559e6dd70da01095e3e7d814892f3f505bab1 (tree)
Hora2012-05-04 02:22:14
AutorDave Brondsema <dbrondsema@geek...>
CommiterYaroslav Luzin

Mensagem de Log

[#4103] set c.user in @td.with_user_project; other test fixes

Mudança Sumário

Diff

--- a/Allura/allura/tests/decorators.py
+++ b/Allura/allura/tests/decorators.py
@@ -11,6 +11,7 @@ def with_user_project(username):
1111 @wraps(func)
1212 def wrapped(*args, **kw):
1313 user = M.User.by_username(username)
14+ c.user = user
1415 n = M.Neighborhood.query.get(name='Users')
1516 shortname = 'u/' + username
1617 p = M.Project.query.get(shortname=shortname, neighborhood_id=n._id)
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -36,11 +36,10 @@ class TestAuth(TestController):
3636
3737 @td.with_user_project('test-admin')
3838 def test_prefs(self):
39- r = self.app.get('/auth/prefs/')
39+ r = self.app.get('/auth/prefs/', extra_environ=dict(username='test-admin'))
4040 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()
4242 # make sure page actually lists all the user's subscriptions
43- subscriptions = list(mailboxes.ming_cursor)
4443 assert len(subscriptions) > 0, 'Test user has no subscriptions, cannot verify that they are shown'
4544 for m in subscriptions:
4645 assert m._id in r, "Page doesn't list subscription for Mailbox._id = %s" % m._id
@@ -48,8 +47,9 @@ class TestAuth(TestController):
4847 'display_name':'Test Admin',
4948 'new_addr.addr':'test@example.com',
5049 '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'))
5353 r = self.app.get('/auth/prefs/')
5454 assert 'test@example.com' in r
5555 r = self.app.post('/auth/prefs/update', params={
@@ -58,19 +58,21 @@ class TestAuth(TestController):
5858 'addr-2.ord':'1',
5959 'addr-2.delete':'on',
6060 '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'))
6364 r = self.app.get('/auth/prefs/')
6465 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')
6667 ea.confirmed = True
6768 ThreadLocalORMSession.flush_all()
6869 r = self.app.post('/auth/prefs/update', params={
6970 'display_name':'Test Admin',
70- 'new_addr.addr':'Beta@wiki.test.projects.sourceforge.net',
71+ 'new_addr.addr':'test-admin@users.localhost',
7172 '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'))
7476
7577 def test_api_key(self):
7678 r = self.app.get('/auth/prefs/')