feat: #20 add email in JWT claims

This commit is contained in:
2022-11-29 13:42:46 +00:00
parent 900dcebcad
commit 78e06756e2
11 changed files with 53 additions and 34 deletions
+4 -5
View File
@@ -17,7 +17,7 @@ class TestResponse(TestCase):
def test_get_target(self, pubkey=None):
resp = requests.post(
URL + "/get/", json={"username": "toto", "password": "tata"}
URL + "/get/", json={"email": "toto@toto.fr", "password": "tata"}
)
self.assertEqual(resp.status_code, 200, "bad status code returned")
self.assertIsNotNone(resp.json(), "response data can't be empty")
@@ -34,6 +34,7 @@ class TestResponse(TestCase):
},
)
self.assertEqual("thegux.fr", jwt_decoded["iss"])
self.assertEqual("toto@toto.fr", jwt_decoded["email"])
jwt_exp = datetime.fromtimestamp(jwt_decoded["exp"])
jwt_iat = datetime.fromtimestamp(jwt_decoded["iat"])
@@ -43,7 +44,7 @@ class TestResponse(TestCase):
def test_validate_target_no_token(self):
resp = requests.post(
URL + "/validate/", json={"username": "toto", "password": "tata"}
URL + "/validate/", json={"username": "toto@toto.fr", "password": "tata"}
)
self.assertEqual(resp.status_code, 200, "bad status code returned")
self.assertIsNotNone(resp.json(), "response data can't be empty")
@@ -92,9 +93,7 @@ class TestResponse(TestCase):
)
def test_bad_credentials(self):
resp = requests.post(
URL + "/get/", json={"username": "tutu", "password": "titi"}
)
resp = requests.post(URL + "/get/", json={"email": "tutu", "password": "titi"})
self.assertEqual(resp.status_code, 403, "bad status code returned")
self.assertIsNotNone(resp.json(), "response data must not be empty")
self.assertEqual(