diff --git a/app.py b/app.py index 66fe667..a622781 100644 --- a/app.py +++ b/app.py @@ -94,10 +94,10 @@ class List(Resource): return schema.get_errors(), 400 -api.add_resource(Verify, "/verify") -api.add_resource(Create, "/create") -api.add_resource(Delete, "/delete") -api.add_resource(List, "/list") +api.add_resource(Verify, "/verify/") +api.add_resource(Create, "/create/") +api.add_resource(Delete, "/delete/") +api.add_resource(List, "/list/") if __name__ == "__main__": app.run(debug=True, host="::", port=decouple.config("PORT", int)) diff --git a/client.py b/client.py index ca0116b..4d8d854 100644 --- a/client.py +++ b/client.py @@ -29,7 +29,7 @@ if action == "list": "admin_realm": args.admin_realm, "admin_token": pyotp.TOTP(args.admin_seed).now() } - r = requests.post("http://localhost:{}/list".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/list/".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8")) @@ -45,7 +45,7 @@ elif action == "create": "admin_realm": args.admin_realm, "admin_token": pyotp.TOTP(args.admin_seed).now() } - r = requests.post("http://localhost:{}/create".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/create/".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8")) @@ -61,7 +61,7 @@ elif action == "verify": "auth_realm": args.auth_realm, "auth_token": pyotp.TOTP(args.auth_seed).now() } - r = requests.post("http://localhost:{}/verify".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/verify/".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8")) @@ -76,6 +76,6 @@ elif action == "delete": "admin_realm": args.admin_realm, "admin_token": pyotp.TOTP(args.admin_seed).now() } - r = requests.post("http://localhost:{}/delete".format(decouple.config('PORT')), + r = requests.post("http://localhost:{}/delete/".format(decouple.config('PORT')), json=data) print(r.content.decode("utf-8")) \ No newline at end of file diff --git a/scripts/create-auth.py b/scripts/create-auth.py index 49c6c4c..10bb2b4 100644 --- a/scripts/create-auth.py +++ b/scripts/create-auth.py @@ -8,7 +8,7 @@ arg_parser = argparse.ArgumentParser() arg_parser.add_argument("admin_seed") args = arg_parser.parse_args() -r = requests.post("http://localhost:{}/create".format(decouple.config("PORT")), +r = requests.post("http://localhost:{}/create/".format(decouple.config("PORT")), json={ "name": "auth", "realm": ["ungleich-auth"], diff --git a/tests/test_uotp.py b/tests/test_uotp.py index 4924af4..a14d9cf 100644 --- a/tests/test_uotp.py +++ b/tests/test_uotp.py @@ -60,7 +60,7 @@ class TestUOTP(unittest.TestCase): 'admin_realm': self.admin_realm, 'admin_token': pyotp.TOTP(self.admin_seed).now() } - r = self.app_client.get('/list', json=json_data) + r = self.app_client.get('/list/', json=json_data) return r def create_otp(self, _name, _realm, @@ -73,7 +73,7 @@ class TestUOTP(unittest.TestCase): "admin_realm": _admin_realm, "admin_token": pyotp.TOTP(_admin_seed).now() } - r = self.app_client.post('/create', json=json_data) + r = self.app_client.post('/create/', json=json_data) return r def verify_otp(self, _name, _realm, _seed, @@ -87,7 +87,7 @@ class TestUOTP(unittest.TestCase): "auth_realm": _auth_realm, "auth_token": pyotp.TOTP(_auth_seed).now() } - r = self.app_client.get('/verify', json=json_data) + r = self.app_client.get('/verify/', json=json_data) return r def test_list(self): @@ -189,7 +189,7 @@ class TestUOTP(unittest.TestCase): 'admin_token': pyotp.TOTP(self.admin_seed).now() } - r = self.app_client.post('/delete', json=json_data) + r = self.app_client.post('/delete/', json=json_data) self.assertEqual(r.status_code, 200) self.assertNotIn(_name, self.get_otp_list().get_json())