allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [2/4] git commit: specify referer in tests, to avoid error in TG 2.2
Date Mon, 10 Dec 2012 16:36:55 GMT
specify referer in tests, to avoid error in TG 2.2


Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8abda8b1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8abda8b1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8abda8b1

Branch: refs/heads/db/tg2.2
Commit: 8abda8b18b7a46398c2fd840d0425e7589eb219d
Parents: ac0ab94
Author: Dave Brondsema <dbrondsema@geek.net>
Authored: Sat Dec 8 22:01:22 2012 +0000
Committer: Dave Brondsema <dbrondsema@geek.net>
Committed: Mon Dec 10 16:36:12 2012 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_auth.py        |   16 +++++++++-----
 Allura/allura/tests/functional/test_discuss.py     |   16 ++++++++++----
 .../allura/tests/functional/test_neighborhood.py   |   11 +++++----
 3 files changed, 27 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8abda8b1/Allura/allura/tests/functional/test_auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_auth.py b/Allura/allura/tests/functional/test_auth.py
index fe31deb..685e242 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -20,9 +20,11 @@ class TestAuth(TestController):
 
     def test_login(self):
         result = self.app.get('/auth/')
-        r = self.app.post('/auth/send_verification_link', params=dict(a='test@example.com'))
+        r = self.app.post('/auth/send_verification_link', params=dict(a='test@example.com'),
+                          extra_environ={'HTTP_REFERER':'/'})
         email = M.User.query.get(username='test-admin').email_addresses[0]
-        r = self.app.post('/auth/send_verification_link', params=dict(a=email))
+        r = self.app.post('/auth/send_verification_link', params=dict(a=email),
+                          extra_environ={'HTTP_REFERER':'/'})
         ThreadLocalORMSession.flush_all()
         r = self.app.get('/auth/verify_addr', params=dict(a='foo'))
         assert json.loads(self.webflash(r))['status'] == 'error', self.webflash(r)
@@ -128,7 +130,7 @@ class TestAuth(TestController):
         subscribed = M.Mailbox.subscribed(project_id=p_id, app_config_id=t_id)
         assert not subscribed, "User already subscribed for tool %s" % t_id
         form.fields[field_name + '.subscribed'][0].value = 'on'
-        form.submit()
+        form.submit(extra_environ={'HTTP_REFERER':'/'})
         subscribed = M.Mailbox.subscribed(project_id=p_id, app_config_id=t_id)
         assert subscribed, "User is not subscribed for tool %s" % t_id
 
@@ -142,19 +144,21 @@ class TestAuth(TestController):
         s = M.Mailbox.query.get(_id=s_id)
         assert s, "User has not subscription with Mailbox._id = %s" % s_id
         form.fields[field_name + '.subscribed'][0].value = None
-        form.submit()
+        form.submit(extra_environ={'HTTP_REFERER':'/'})
         s = M.Mailbox.query.get(_id=s_id)
         assert not s, "User still has subscription with Mailbox._id %s" % s_id
 
     def test_api_key(self):
          r = self.app.get('/auth/prefs/')
          assert 'No API token generated' in r
-         r = self.app.post('/auth/prefs/gen_api_token', status=302)
+         r = self.app.post('/auth/prefs/gen_api_token', status=302,
+                           extra_environ={'HTTP_REFERER':'/'})
          r = self.app.get('/auth/prefs/')
          assert 'No API token generated' not in r
          assert 'API Key:' in r
          assert 'Secret Key:' in r
-         r = self.app.post('/auth/prefs/del_api_token', status=302)
+         r = self.app.post('/auth/prefs/del_api_token', status=302,
+                           extra_environ={'HTTP_REFERER':'/'})
          r = self.app.get('/auth/prefs/')
          assert 'No API token generated' in r
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8abda8b1/Allura/allura/tests/functional/test_discuss.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_discuss.py b/Allura/allura/tests/functional/test_discuss.py
index 2e0b64c..192ecbd 100644
--- a/Allura/allura/tests/functional/test_discuss.py
+++ b/Allura/allura/tests/functional/test_discuss.py
@@ -90,9 +90,12 @@ class TestDiscuss(TestController):
         r = self.app.get(thread_link)
         assert 'Tis a reply' in r, r
         permalinks = [post.find('form')['action'].encode('utf-8') for post in r.html.findAll('div',{'class':'edit_post_form
reply'})]
-        self.app.post(permalinks[1]+'flag')
-        self.app.post(permalinks[1]+'moderate', params=dict(delete='delete'))
-        self.app.post(permalinks[0]+'moderate', params=dict(spam='spam'))
+        self.app.post(permalinks[1]+'flag',
+                      extra_environ={'HTTP_REFERER':'/'})
+        self.app.post(permalinks[1]+'moderate', params=dict(delete='delete'),
+                      extra_environ={'HTTP_REFERER':'/'})
+        self.app.post(permalinks[0]+'moderate', params=dict(spam='spam'),
+                      extra_environ={'HTTP_REFERER':'/'})
 
     def test_post_paging(self):
         home = self.app.get('/wiki/_discuss/')
@@ -118,7 +121,7 @@ class TestDiscuss(TestController):
             if field.has_key('name'):
                 params[field['name']] = field.has_key('value') and field['value'] or ''
         params[reply_form.find('textarea')['name']] = 'zzz'
-        self.app.post(post_link, params)
+        self.app.post(post_link, params, extra_environ={'HTTP_REFERER':'/'})
         assert create_activity.call_count == 1, create_activity.call_count
         assert create_activity.call_args[0][1] == 'modified'
         r = self.app.get(thread_url)
@@ -151,6 +154,7 @@ class TestAttachment(TestController):
 
     def test_attach(self):
         r = self.app.post(self.post_link + 'attach',
+                          extra_environ={'HTTP_REFERER':'/'},
                           upload_files=[('file_info', 'test.txt', 'HiThere!')])
         r = self.app.get(self.thread_link)
         for alink in r.html.findAll('a'):
@@ -162,5 +166,7 @@ class TestAttachment(TestController):
         r = self.app.get(alink)
         assert r.content_disposition == 'attachment;filename="test.txt"', 'Attachments should
force download'
         r = self.app.post(self.post_link + 'attach',
+                          extra_environ={'HTTP_REFERER': '/'},
                           upload_files=[('file_info', 'test.o12', 'HiThere!')])
-        r = self.app.post(alink, params=dict(delete='on'))
+        r = self.app.post(alink, params=dict(delete='on'),
+                          extra_environ={'HTTP_REFERER': '/'},)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8abda8b1/Allura/allura/tests/functional/test_neighborhood.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_neighborhood.py b/Allura/allura/tests/functional/test_neighborhood.py
index 537731b..55f173b 100644
--- a/Allura/allura/tests/functional/test_neighborhood.py
+++ b/Allura/allura/tests/functional/test_neighborhood.py
@@ -679,10 +679,11 @@ class TestNeighborhood(TestController):
         r = self.app.get('/adobe/_admin/awards', extra_environ=dict(username='root'))
         r = self.app.post('/adobe/_admin/awards/create',
                           params=dict(short='FOO', full='A basic foo award'),
-                          extra_environ=dict(username='root'), upload_files=[upload])
+                          extra_environ=dict(username='root', HTTP_REFERER='/'),
+                          upload_files=[upload])
         r = self.app.post('/adobe/_admin/awards/create',
                           params=dict(short='BAR', full='A basic bar award with no icon'),
-                          extra_environ=dict(username='root'))
+                          extra_environ=dict(username='root', HTTP_REFERER='/'))
         foo_id = str(M.Award.query.find(dict(short='FOO')).first()._id)
         bar_id = str(M.Award.query.find(dict(short='BAR')).first()._id)
         r = self.app.post('/adobe/_admin/awards/%s/update' % bar_id,
@@ -696,12 +697,12 @@ class TestNeighborhood(TestController):
         assert image.size == (48, 48)
         self.app.post('/adobe/_admin/awards/grant',
                           params=dict(grant='FOO', recipient='adobe-1'),
-                          extra_environ=dict(username='root'))
+                          extra_environ=dict(username='root', HTTP_REFERER='/'))
         self.app.get('/adobe/_admin/awards/%s/adobe-1' % foo_id, extra_environ=dict(username='root'))
         self.app.post('/adobe/_admin/awards/%s/adobe-1/revoke' % foo_id,
-                          extra_environ=dict(username='root'))
+                          extra_environ=dict(username='root', HTTP_REFERER='/'))
         self.app.post('/adobe/_admin/awards/%s/delete' % foo_id,
-                          extra_environ=dict(username='root'))
+                          extra_environ=dict(username='root', HTTP_REFERER='/'))
 
     def test_add_a_project_link(self):
         # Install Home tool for all neighborhoods


Mime
View raw message