forward slash added after every endpoint
This commit is contained in:
parent
8f97bb0335
commit
9b7d8af0e5
4 changed files with 13 additions and 13 deletions
8
app.py
8
app.py
|
@ -94,10 +94,10 @@ class List(Resource):
|
||||||
return schema.get_errors(), 400
|
return schema.get_errors(), 400
|
||||||
|
|
||||||
|
|
||||||
api.add_resource(Verify, "/verify")
|
api.add_resource(Verify, "/verify/")
|
||||||
api.add_resource(Create, "/create")
|
api.add_resource(Create, "/create/")
|
||||||
api.add_resource(Delete, "/delete")
|
api.add_resource(Delete, "/delete/")
|
||||||
api.add_resource(List, "/list")
|
api.add_resource(List, "/list/")
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app.run(debug=True, host="::", port=decouple.config("PORT", int))
|
app.run(debug=True, host="::", port=decouple.config("PORT", int))
|
||||||
|
|
|
@ -29,7 +29,7 @@ if action == "list":
|
||||||
"admin_realm": args.admin_realm,
|
"admin_realm": args.admin_realm,
|
||||||
"admin_token": pyotp.TOTP(args.admin_seed).now()
|
"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)
|
json=data)
|
||||||
print(r.content.decode("utf-8"))
|
print(r.content.decode("utf-8"))
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ elif action == "create":
|
||||||
"admin_realm": args.admin_realm,
|
"admin_realm": args.admin_realm,
|
||||||
"admin_token": pyotp.TOTP(args.admin_seed).now()
|
"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)
|
json=data)
|
||||||
print(r.content.decode("utf-8"))
|
print(r.content.decode("utf-8"))
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ elif action == "verify":
|
||||||
"auth_realm": args.auth_realm,
|
"auth_realm": args.auth_realm,
|
||||||
"auth_token": pyotp.TOTP(args.auth_seed).now()
|
"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)
|
json=data)
|
||||||
print(r.content.decode("utf-8"))
|
print(r.content.decode("utf-8"))
|
||||||
|
|
||||||
|
@ -76,6 +76,6 @@ elif action == "delete":
|
||||||
"admin_realm": args.admin_realm,
|
"admin_realm": args.admin_realm,
|
||||||
"admin_token": pyotp.TOTP(args.admin_seed).now()
|
"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)
|
json=data)
|
||||||
print(r.content.decode("utf-8"))
|
print(r.content.decode("utf-8"))
|
|
@ -8,7 +8,7 @@ arg_parser = argparse.ArgumentParser()
|
||||||
arg_parser.add_argument("admin_seed")
|
arg_parser.add_argument("admin_seed")
|
||||||
args = arg_parser.parse_args()
|
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={
|
json={
|
||||||
"name": "auth",
|
"name": "auth",
|
||||||
"realm": ["ungleich-auth"],
|
"realm": ["ungleich-auth"],
|
||||||
|
|
|
@ -60,7 +60,7 @@ class TestUOTP(unittest.TestCase):
|
||||||
'admin_realm': self.admin_realm,
|
'admin_realm': self.admin_realm,
|
||||||
'admin_token': pyotp.TOTP(self.admin_seed).now()
|
'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
|
return r
|
||||||
|
|
||||||
def create_otp(self, _name, _realm,
|
def create_otp(self, _name, _realm,
|
||||||
|
@ -73,7 +73,7 @@ class TestUOTP(unittest.TestCase):
|
||||||
"admin_realm": _admin_realm,
|
"admin_realm": _admin_realm,
|
||||||
"admin_token": pyotp.TOTP(_admin_seed).now()
|
"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
|
return r
|
||||||
|
|
||||||
def verify_otp(self, _name, _realm, _seed,
|
def verify_otp(self, _name, _realm, _seed,
|
||||||
|
@ -87,7 +87,7 @@ class TestUOTP(unittest.TestCase):
|
||||||
"auth_realm": _auth_realm,
|
"auth_realm": _auth_realm,
|
||||||
"auth_token": pyotp.TOTP(_auth_seed).now()
|
"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
|
return r
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
|
@ -189,7 +189,7 @@ class TestUOTP(unittest.TestCase):
|
||||||
'admin_token': pyotp.TOTP(self.admin_seed).now()
|
'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.assertEqual(r.status_code, 200)
|
||||||
self.assertNotIn(_name, self.get_otp_list().get_json())
|
self.assertNotIn(_name, self.get_otp_list().get_json())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue