forward slash added after every endpoint

This commit is contained in:
ahmadbilalkhalid 2019-11-27 22:19:18 +05:00
parent 8f97bb0335
commit 9b7d8af0e5
4 changed files with 13 additions and 13 deletions

8
app.py
View file

@ -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))

View file

@ -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"))

View file

@ -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"],

View file

@ -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())