Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,11 @@ async def test_jwt_token_generation_with_expiration(self):
async def test_token_decode(self):
res = await self.kong.decode_token(
"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJ5ZTBRdURsNG03UW1qbnpFR0pJaUVyQnZieFBqSXM3VyIsImV4cCI6MTY1"
"MDM2NzE0NywibmJmIjoxNjUwMzY3MDI3fQ.SDH5Zq1mUSU0GkCyC_kF81_uoiF45u62Hgwnuv4wl5U")
self.assertIn('iss', res)
self.assertIn('exp', res)
self.assertIn('nbf', res)
"MDM2NzE0NywibmJmIjoxNjUwMzY3MDI3fQ.SDH5Zq1mUSU0GkCyC_kF81_uoiF45u62Hgwnuv4wl5U"
)
self.assertIn("iss", res)
self.assertIn("exp", res)
self.assertIn("nbf", res)

async def test_get_token_by_id(self):
user_uuid = uuid4()
Expand All @@ -255,12 +256,12 @@ async def test_get_token_by_id(self):

self.assertGreater(len(token), 50)

response = await self.kong.get_jwt_by_id(resp['id'])
response = await self.kong.get_jwt_by_id(resp["id"])
self.assertTrue(200 == response.status_code)
resp = response.json()

self.assertIn('key', resp)
self.assertIn('secret', resp)
self.assertIn("key", resp)
self.assertIn("secret", resp)

async def test_get_consumer_jwts(self):
user_uuid = uuid4()
Expand All @@ -278,7 +279,7 @@ async def test_get_consumer_jwts(self):
self.assertTrue(200 == response.status_code)
resp = response.json()

self.assertEqual(len(resp['data']), 1)
self.assertEqual(len(resp["data"]), 1)


class TestKongClientFromConfig(unittest.IsolatedAsyncioTestCase):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,27 @@ async def test_subscribe_with_auth(self):
5660,
name,
[
{"url": "/", "method": "GET", "authenticated": True, "authorized_groups": ["super_admin", "admin"], "regex_priority": 0},
{"url": "/foo", "method": "POST", "authenticated": True, "authorized_groups": ["super_admin", "admin"], "regex_priority": 0},
{"url": "/bar", "method": "GET", "authenticated": True, "authorized_groups": ["super_admin", "admin"], "regex_priority": 0},
{
"url": "/",
"method": "GET",
"authenticated": True,
"authorized_groups": ["super_admin", "admin"],
"regex_priority": 0,
},
{
"url": "/foo",
"method": "POST",
"authenticated": True,
"authorized_groups": ["super_admin", "admin"],
"regex_priority": 0,
},
{
"url": "/bar",
"method": "GET",
"authenticated": True,
"authorized_groups": ["super_admin", "admin"],
"regex_priority": 0,
},
],
)
self.assertTrue(201 == response.status_code)
Expand Down