incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tvansteenbu...@apache.org
Subject git commit: [#6831] Fix tests for new rest api auth logic
Date Thu, 12 Dec 2013 07:21:43 GMT
Updated Branches:
  refs/heads/master bad824c93 -> 2426f037a


[#6831] Fix tests for new rest api auth logic

You must explicitly specify anon user for a test rest request now,
since the user will not automatically become anon if oauth or api key
authentication fails (instead, auth falls back to session cookie,
which, in the case of functional tests, would by default be an
admin user.

Also, an authorization failure for a rest request will now return
a 403 instead of a 401, since the user will be authenticated
instead of implicitly set to anon like before (in tests where
anon is not explicitly used).

Signed-off-by: Tim Van Steenburgh <tvansteenburgh@gmail.com>


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

Branch: refs/heads/master
Commit: 2426f037a62605c5e899e28e083dbb9802cfe2f2
Parents: bad824c
Author: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Authored: Thu Dec 12 07:21:26 2013 +0000
Committer: Tim Van Steenburgh <tvansteenburgh@gmail.com>
Committed: Thu Dec 12 07:21:26 2013 +0000

----------------------------------------------------------------------
 Allura/allura/tests/functional/test_rest.py             | 2 +-
 ForgeTracker/forgetracker/tests/functional/test_root.py | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2426f037/Allura/allura/tests/functional/test_rest.py
----------------------------------------------------------------------
diff --git a/Allura/allura/tests/functional/test_rest.py b/Allura/allura/tests/functional/test_rest.py
index ea4b769..6829434 100644
--- a/Allura/allura/tests/functional/test_rest.py
+++ b/Allura/allura/tests/functional/test_rest.py
@@ -191,7 +191,7 @@ class TestRestHome(TestRestApiBase):
                      status=401)
         self.app.get('/rest/p/test/wiki/Home/',
                      extra_environ={'username': 'test-user-0'},
-                     status=401)
+                     status=403)
 
     def test_index(self):
         eps = {

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/2426f037/ForgeTracker/forgetracker/tests/functional/test_root.py
----------------------------------------------------------------------
diff --git a/ForgeTracker/forgetracker/tests/functional/test_root.py b/ForgeTracker/forgetracker/tests/functional/test_root.py
index 5a8fc15..d97fadb 100644
--- a/ForgeTracker/forgetracker/tests/functional/test_root.py
+++ b/ForgeTracker/forgetracker/tests/functional/test_root.py
@@ -572,11 +572,11 @@ class TestFunctionalController(TrackerTestController):
         r = self.app.get(ticket_view.request.url, extra_environ=env)
         assert 'Private Ticket' not in r
         # ... and it doesn't appear in the feed
-        r = self.app.get('/p/test/bugs/feed.atom')
+        r = self.app.get('/p/test/bugs/feed.atom', extra_environ=env)
         assert 'Private Ticket' not in r
         # ... or in the API ...
-        r = self.app.get('/rest/p/test/bugs/2/', status=401)
-        r = self.app.get('/rest/p/test/bugs/')
+        r = self.app.get('/rest/p/test/bugs/2/', extra_environ=env, status=401)
+        r = self.app.get('/rest/p/test/bugs/', extra_environ=env)
         assert 'Private Ticket' not in r
 
         # update private ticket


Mime
View raw message