summaryrefslogtreecommitdiff
path: root/tests/oauth2/draft25/test_client.py
diff options
context:
space:
mode:
authorEunchong Yu <kroisse@gmail.com>2013-05-08 03:54:49 +0900
committerEunchong Yu <kroisse@gmail.com>2013-05-08 03:54:49 +0900
commite02afa5c5ea05ccc3f851ca48e3c734a919203a3 (patch)
treecac6277c296713a9cbbeef2d3d919b473d1cec9e /tests/oauth2/draft25/test_client.py
parent2cfcc6a6d687257e69b5904029373e0ba54850cb (diff)
downloadoauthlib-e02afa5c5ea05ccc3f851ca48e3c734a919203a3.tar.gz
Check data with extra parameters by the right way
Length-checking asserts are replaced to the appropriate assert methods, assertURLEqual() and assertFormBodyEqual(), introduced in e2db7dd548dc286001e1fc9f43caef1501d2c926.
Diffstat (limited to 'tests/oauth2/draft25/test_client.py')
-rw-r--r--tests/oauth2/draft25/test_client.py25
1 files changed, 10 insertions, 15 deletions
diff --git a/tests/oauth2/draft25/test_client.py b/tests/oauth2/draft25/test_client.py
index acceaca..9d1fac5 100644
--- a/tests/oauth2/draft25/test_client.py
+++ b/tests/oauth2/draft25/test_client.py
@@ -223,10 +223,9 @@ class WebApplicationClientTest(TestCase):
uri = client.prepare_request_uri(self.uri, state=self.state)
self.assertURLEqual(uri, self.uri_state)
- # With extra parameters through kwargs, checking using len since order
- # of dict items is undefined
+ # With extra parameters through kwargs
uri = client.prepare_request_uri(self.uri, **self.kwargs)
- self.assertEqual(len(uri), len(self.uri_kwargs))
+ self.assertURLEqual(uri, self.uri_kwargs)
def test_request_body(self):
client = WebApplicationClient(self.client_id, code=self.code)
@@ -243,10 +242,9 @@ class WebApplicationClientTest(TestCase):
body = client.prepare_request_body(body=self.body, redirect_uri=self.redirect_uri)
self.assertFormBodyEqual(body, self.body_redirect)
- # With extra parameters, checked using length since order of
- # dict items is undefined
+ # With extra parameters
body = client.prepare_request_body(body=self.body, **self.kwargs)
- self.assertEqual(len(body), len(self.body_kwargs))
+ self.assertFormBodyEqual(body, self.body_kwargs)
def test_parse_grant_uri_response(self):
client = WebApplicationClient(self.client_id)
@@ -328,10 +326,9 @@ class UserAgentClientTest(TestCase):
uri = client.prepare_request_uri(self.uri, state=self.state)
self.assertURLEqual(uri, self.uri_state)
- # With extra parameters through kwargs, checking using len since order
- # of dict items is undefined
+ # With extra parameters through kwargs
uri = client.prepare_request_uri(self.uri, **self.kwargs)
- self.assertEqual(len(uri), len(self.uri_kwargs))
+ self.assertURLEqual(uri, self.uri_kwargs)
def test_parse_token_response(self):
client = UserAgentClient(self.client_id)
@@ -386,11 +383,10 @@ class PasswordCredentialsClientTest(TestCase):
body=self.body)
self.assertFormBodyEqual(body, self.body_up)
- # With extra parameters, checked using length since order of
- # dict items is undefined
+ # With extra parameters
body = client.prepare_request_body(self.username, self.password,
body=self.body, **self.kwargs)
- self.assertEqual(len(body), len(self.body_kwargs))
+ self.assertFormBodyEqual(body, self.body_kwargs)
def test_parse_token_response(self):
client = PasswordCredentialsClient(self.client_id)
@@ -444,10 +440,9 @@ class ClientCredentialsClientTest(TestCase):
body = rclient.prepare_request_body(body=self.body)
self.assertFormBodyEqual(body, self.body_up)
- # With extra parameters, checked using length since order of
- # dict items is undefined
+ # With extra parameters
body = client.prepare_request_body(body=self.body, **self.kwargs)
- self.assertEqual(len(body), len(self.body_kwargs))
+ self.assertFormBodyEqual(body, self.body_kwargs)
def test_parse_token_response(self):
client = ClientCredentialsClient(self.client_id)