def test_token_is_expired(self): token = Token(**self.data) self.assertFalse(token.is_expired()) self.data['expires_in'] = 0 token = Token(**self.data) self.assertTrue(token.is_expired())
def setUp(self): self.data = { 'host': 'http://localhost', 'client': 'client', 'secret': 'secret', } self.token_response = { 'scope': 'devices', 'expires_in': 10, 'access_token': 'super-token', 'token_type': 'bearer' } self.token = Token(**self.token_response)
def setUp(self): self.data = { 'publichost': 'http://localhost:4444', 'adminhost': 'http://localhost:4445', 'client': 'client', 'secret': 'secret', } self.token_response = { 'scope': 'devices', 'expires_in': 10, 'access_token': 'super-token', 'token_type': 'bearer' } self.token = Token(**self.token_response) self.challenge = '0f4a657306bb476b9d95131d686d15ad'
def test_string_representation(self): token = Token(**self.data) expected = 'bearer super-token' self.assertEqual(str(token), expected)
def test_can_create_token(self): token = Token(**self.data) self.assertEqual(token.scope, 'hydra') self.assertEqual(token.expires_in, 10) self.assertEqual(token.token, 'super-token') self.assertEqual(token.type, 'bearer')