diff --git a/Cargo.lock b/Cargo.lock index 79283d8..1c239cc 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1231,7 +1231,7 @@ dependencies = [ [[package]] name = "simple-auth" -version = "0.2.0" +version = "0.3.0" dependencies = [ "async-std", "async-trait", diff --git a/tests/python/test_requests.py b/tests/python/test_requests.py index 9247873..d056989 100644 --- a/tests/python/test_requests.py +++ b/tests/python/test_requests.py @@ -15,7 +15,7 @@ class TestResponse(TestCase): with open(PUB_KEY_PATH, "r") as f: self.pub_key = f.read() - def test_get_target(self): + def test_get_target(self, pubkey=None): resp = requests.post( URL + "/get/", json={"username": "toto", "password": "tata"} ) @@ -25,7 +25,7 @@ class TestResponse(TestCase): token = resp.json()["token"] jwt_decoded = jwt.decode( token, - self.pub_key, + pubkey or self.pub_key, algorithms=["RS384"], options={ "verify_signature": True, @@ -123,7 +123,10 @@ class TestResponse(TestCase): b64_pubkey = base64.b64decode(resp.json()["pubkey"]) self.assertIsNotNone(b64_pubkey, "public key b64 decoded can't be empty") - self.assertIn("-BEGIN PUBLIC KEY-", b64_pubkey.decode()) + b64_pubkey_decoded = b64_pubkey.decode() + self.assertIn("-BEGIN PUBLIC KEY-", b64_pubkey_decoded) + + self.test_get_target(b64_pubkey_decoded) def test_get_pubkey_bad_method(self): resp = requests.post(URL + "/pubkey/", json={"tutu": "toto"})