diff options
author | Ib Lundgren <ib.lundgren@gmail.com> | 2014-10-23 18:27:29 +0100 |
---|---|---|
committer | Ib Lundgren <ib.lundgren@gmail.com> | 2014-10-23 18:27:29 +0100 |
commit | a144769a9a44c85eb17774e7a513ffc5a92a354d (patch) | |
tree | 0e26fa93fd16eb9d749ecdfaca2c98339bfc20fa /tests/oauth2/rfc6749/clients/test_web_application.py | |
parent | 456d85faf277b130a8710a5744e04b13caa72747 (diff) | |
parent | 809553ccb71f5c046454e5ce2ac90ab0757729f0 (diff) | |
download | oauthlib-a144769a9a44c85eb17774e7a513ffc5a92a354d.tar.gz |
Merge branch 'scope-change-signal' of https://github.com/singingwolfboy/oauthlib into singingwolfboy-scope-change-signal
Conflicts:
oauthlib/oauth2/rfc6749/clients/backend_application.py
oauthlib/oauth2/rfc6749/clients/legacy_application.py
oauthlib/oauth2/rfc6749/clients/web_application.py
Diffstat (limited to 'tests/oauth2/rfc6749/clients/test_web_application.py')
-rw-r--r-- | tests/oauth2/rfc6749/clients/test_web_application.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/tests/oauth2/rfc6749/clients/test_web_application.py b/tests/oauth2/rfc6749/clients/test_web_application.py index 0eac008..6f7b7e1 100644 --- a/tests/oauth2/rfc6749/clients/test_web_application.py +++ b/tests/oauth2/rfc6749/clients/test_web_application.py @@ -5,7 +5,7 @@ import datetime from mock import patch -from oauthlib import common +from oauthlib import common, signals from oauthlib.oauth2.rfc6749 import utils, errors from oauthlib.oauth2 import Client from oauthlib.oauth2 import WebApplicationClient @@ -128,4 +128,17 @@ class WebApplicationClientTest(TestCase): self.assertEqual(client.token_type, response.get("token_type")) # Mismatching state - self.assertRaises(Warning, client.parse_request_body_response, self.token_json, scope="invalid") + scope_changes_recorded = [] + def record_scope_change(sender, message, old, new): + scope_changes_recorded.append((message, old, new)) + + signals.scope_changed.connect(record_scope_change) + try: + client.parse_request_body_response(self.token_json, scope="invalid") + self.assertEqual(len(scope_changes_recorded), 1) + message, old, new = scope_changes_recorded[0] + self.assertEqual(message, 'Scope has changed from "invalid" to "/profile".') + self.assertEqual(old, ['invalid']) + self.assertEqual(new, ['/profile']) + finally: + signals.scope_changed.disconnect(record_scope_change) |