summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIb Lundgren <ib.lundgren@gmail.com>2012-11-18 18:59:58 +0100
committerIb Lundgren <ib.lundgren@gmail.com>2012-11-18 18:59:58 +0100
commit66701d5a0ecd802a5bcc1fc8373f03058722f7a8 (patch)
tree3f2d635e54cecf3c153bfc323a34a85037c74cbc
parentb89a7476916e4fd04c1a5c27dde614fbc5acecd5 (diff)
downloadoauthlib-66701d5a0ecd802a5bcc1fc8373f03058722f7a8.tar.gz
Sketching out some endpoint tests
-rw-r--r--tests/oauth2/draft25/test_server.py75
1 files changed, 71 insertions, 4 deletions
diff --git a/tests/oauth2/draft25/test_server.py b/tests/oauth2/draft25/test_server.py
index 3e0429b..3d09520 100644
--- a/tests/oauth2/draft25/test_server.py
+++ b/tests/oauth2/draft25/test_server.py
@@ -1,11 +1,78 @@
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from ...unittest import TestCase
+import mock
+from oauthlib.oauth2.draft25 import AuthorizationEndpoint, TokenEndpoint
+from oauthlib.oauth2.draft25 import ResourceEndpoint
+from oauthlib.oauth2.draft25.grant_types import AuthorizationCodeGrant
+from oauthlib.oauth2.draft25.grant_types import ImplicitGrant
+from oauthlib.oauth2.draft25.grant_types import ResourceOwnerPasswordCredentialsGrant
+from oauthlib.oauth2.draft25.grant_types import ClientCredentialsGrant
-class AuthorizationEndpoint(TestCase):
- pass
+class AuthorizationEndpointTest(TestCase):
-class TokenEndpoint(TestCase):
- pass
+ def setUp(self):
+ mock_validator = mock.MagicMock()
+ auth_code = AuthorizationCodeGrant(request_validator=mock_validator)
+ implicit = ImplicitGrant(request_validator=mock_validator)
+ response_types = {
+ 'code': auth_code,
+ 'token': implicit,
+ }
+ self.endpoint = AuthorizationEndpoint(response_types=response_types)
+
+ def test_authorization_grant(self):
+ pass
+
+ def test_implicit_grant(self):
+ pass
+
+ def test_missing_type(self):
+ pass
+
+ def test_invalid_type(self):
+ pass
+
+
+class TokenEndpointTest(TestCase):
+
+ def setUp(self):
+ mock_validator = mock.MagicMock()
+ auth_code = AuthorizationCodeGrant(request_validator=mock_validator)
+ password = ResourceOwnerPasswordCredentialsGrant(request_validator=mock_validator)
+ client = ClientCredentialsGrant(request_validator=mock_validator)
+ grant_types = {
+ 'authorization_code': auth_code,
+ 'password': password,
+ 'client_credentials': client,
+ }
+ self.endpoint = TokenEndpoint(grant_types=grant_types)
+
+ def test_authorization_grant(self):
+ pass
+
+ def test_password_grant(self):
+ pass
+
+ def test_client_grant(self):
+ pass
+
+ def test_missing_type(self):
+ pass
+
+ def test_invalid_type(self):
+ pass
+
+
+class ResourceEndpointTest(TestCase):
+
+ def setUp(self):
+ self.endpoint = ResourceEndpoint()
+
+ def test_token_validation(self):
+ pass
+
+ def test_token_estimation(self):
+ pass