Skip to content

Commit

Permalink
Merge pull request #594 from jdufresne/isinstance
Browse files Browse the repository at this point in the history
Prefer assertIsInstance(...) over assertTrue(isinstance(...))
  • Loading branch information
JonathanHuot committed Sep 14, 2018
2 parents a49c773 + aef9a3e commit 03bbcca
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion tests/oauth1/rfc5849/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ClientConstructorTests(TestCase):
def test_convert_to_unicode_resource_owner(self):
client = Client('client-key',
resource_owner_key=b'owner key')
self.assertFalse(isinstance(client.resource_owner_key, bytes_type))
self.assertNotIsInstance(client.resource_owner_key, bytes_type)
self.assertEqual(client.resource_owner_key, 'owner key')

def test_give_explicit_timestamp(self):
Expand Down
14 changes: 7 additions & 7 deletions tests/openid/connect/core/grant_types/test_dispatchers.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,23 @@ def test_create_authorization_response_openid(self):
self.request.scopes = ('hello', 'openid')
self.request.response_type = 'id_token'
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, ImplicitGrant))
self.assertIsInstance(handler, ImplicitGrant)

def test_validate_authorization_request_openid(self):
self.request.scopes = ('hello', 'openid')
self.request.response_type = 'id_token'
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, ImplicitGrant))
self.assertIsInstance(handler, ImplicitGrant)

def test_create_authorization_response_oauth(self):
self.request.scopes = ('hello', 'world')
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, ImplicitGrant))
self.assertIsInstance(handler, ImplicitGrant)

def test_validate_authorization_request_oauth(self):
self.request.scopes = ('hello', 'world')
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, ImplicitGrant))
self.assertIsInstance(handler, ImplicitGrant)


class DispatcherTest(TestCase):
Expand Down Expand Up @@ -82,7 +82,7 @@ def setUp(self):

def test_create_token_response_openid(self):
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, AuthorizationCodeGrant))
self.assertIsInstance(handler, AuthorizationCodeGrant)
self.assertTrue(self.dispatcher.request_validator.get_authorization_code_scopes.called)


Expand All @@ -104,7 +104,7 @@ def setUp(self):

def test_create_token_response_openid_without_code(self):
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, OAuth2AuthorizationCodeGrant))
self.assertIsInstance(handler, OAuth2AuthorizationCodeGrant)
self.assertFalse(self.dispatcher.request_validator.get_authorization_code_scopes.called)


Expand All @@ -121,5 +121,5 @@ def setUp(self):

def test_create_token_response_oauth(self):
handler = self.dispatcher._handler_for_request(self.request)
self.assertTrue(isinstance(handler, OAuth2AuthorizationCodeGrant))
self.assertIsInstance(handler, OAuth2AuthorizationCodeGrant)
self.assertTrue(self.dispatcher.request_validator.get_authorization_code_scopes.called)

0 comments on commit 03bbcca

Please sign in to comment.