You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by jo...@apache.org on 2013/06/21 23:34:35 UTC
[23/38] git commit: [#6289] ticket:372 changed action for oauth
revoke access form
[#6289] ticket:372 changed action for oauth revoke access form
Project: http://git-wip-us.apache.org/repos/asf/incubator-allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-allura/commit/8748f7a7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-allura/tree/8748f7a7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-allura/diff/8748f7a7
Branch: refs/heads/cj/6272
Commit: 8748f7a7b766f66e8a8170e6770ef103614dca61
Parents: eb7b35e
Author: Yuriy Arhipov <yu...@yandex.ru>
Authored: Fri Jun 14 15:23:56 2013 +0400
Committer: Cory Johns <cj...@slashdotmedia.com>
Committed: Tue Jun 18 17:08:20 2013 +0000
----------------------------------------------------------------------
Allura/allura/controllers/auth.py | 4 ++--
Allura/allura/tests/functional/test_auth.py | 24 +++++++++++++++++++-----
2 files changed, 21 insertions(+), 7 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8748f7a7/Allura/allura/controllers/auth.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/auth.py b/Allura/allura/controllers/auth.py
index 21def31..5b3acf3 100644
--- a/Allura/allura/controllers/auth.py
+++ b/Allura/allura/controllers/auth.py
@@ -61,7 +61,7 @@ class F(object):
subscription_form=SubscriptionForm()
registration_form = forms.RegistrationForm(action='/auth/save_new')
oauth_application_form = OAuthApplicationForm(action='register')
- oauth_revocation_form = OAuthRevocationForm(action='revoke_oauth')
+ oauth_revocation_form = OAuthRevocationForm(action='/auth/preferences/revoke_oauth')
change_personal_data_form = forms.PersonalDataForm()
add_socialnetwork_form = forms.AddSocialNetworkForm()
remove_socialnetwork_form = forms.RemoveSocialNetworkForm()
@@ -408,7 +408,7 @@ class PreferencesController(BaseController):
redirect('.')
tok.delete()
flash('Application access revoked')
- redirect('.')
+ redirect(request.referer)
@expose()
@require_post()
http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/8748f7a7/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 247e8b8..5ac1168 100644
--- a/Allura/allura/tests/functional/test_auth.py
+++ b/Allura/allura/tests/functional/test_auth.py
@@ -187,11 +187,25 @@ class TestAuth(TestController):
assert 'No API token generated' in r
def test_oauth(self):
- r = self.app.get('/auth/oauth/')
- r = self.app.post('/auth/oauth/register', params={'application_name': 'oautstapp', 'application_description': 'Oauth rulez'}).follow()
- assert 'oautstapp' in r
- r = self.app.post('/auth/oauth/delete').follow()
- assert 'Invalid app ID' in r
+ r = self.app.get('/auth/oauth/')
+ r = self.app.post('/auth/oauth/register', params={'application_name': 'oautstapp', 'application_description': 'Oauth rulez'}).follow()
+ assert 'oautstapp' in r
+ r = self.app.post('/auth/oauth/delete').follow()
+ assert 'Invalid app ID' in r
+
+ def test_revoke_access(self):
+ self.app.post('/auth/oauth/register', params={'application_name': 'oautstapp', 'application_description': 'Oauth rulez'}).follow()
+ M.OAuthAccessToken(
+ consumer_token_id=None,
+ request_token_id=None,
+ user_id=M.User.by_username('test-admin')._id)
+ ThreadLocalORMSession.flush_all()
+ r = self.app.get('/auth/subscriptions/')
+ assert '<form method="post" action="/auth/preferences/revoke_oauth">' in r
+ r.forms[0].submit()
+ r = self.app.get('/auth/subscriptions/')
+ assert '<form method="post" action="/auth/preferences/revoke_oauth">' not in r
+ assert_equal(M.OAuthAccessToken.for_user(M.User.by_username('test-admin')), [])
@mock.patch('allura.controllers.auth.verify_oid')
def test_login_verify_oid_with_provider(self, verify_oid):