feat: Add curl error page and new tests
All checks were successful
Build Docker / BuildImage (push) Successful in 52s
All checks were successful
Build Docker / BuildImage (push) Successful in 52s
This commit is contained in:
7
curl.py
7
curl.py
@@ -123,4 +123,9 @@ def curl_response(request):
|
|||||||
if os.path.exists(f"templates/{path}.html"):
|
if os.path.exists(f"templates/{path}.html"):
|
||||||
return render_template(f"{path}.html")
|
return render_template(f"{path}.html")
|
||||||
|
|
||||||
return error_response(request)
|
# Return curl error page
|
||||||
|
error = {
|
||||||
|
"code": 404,
|
||||||
|
"message": "The requested resource was not found on this server."
|
||||||
|
}
|
||||||
|
return render_template("error.ascii",header=get_header(),error=error), 404, {'Content-Type': 'text/plain; charset=utf-8'}
|
||||||
9
templates/error.ascii
Normal file
9
templates/error.ascii
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
{{header}}
|
||||||
|
[1;36m───────────────────────────────────────────────[0m
|
||||||
|
[1;31m ERROR: {{ error.code }} [0m
|
||||||
|
[1;36m────────────[0m
|
||||||
|
|
||||||
|
[1;31m{{ error.message }}[0m
|
||||||
|
|
||||||
|
If you believe this is an error, please contact me via my socials listed at /contact
|
||||||
|
|
||||||
@@ -6,10 +6,15 @@ GET http://127.0.0.1:5000/api/v1/ip
|
|||||||
HTTP 200
|
HTTP 200
|
||||||
[Asserts]
|
[Asserts]
|
||||||
jsonpath "$.ip" == "127.0.0.1"
|
jsonpath "$.ip" == "127.0.0.1"
|
||||||
|
|
||||||
GET http://127.0.0.1:5000/api/v1/time
|
GET http://127.0.0.1:5000/api/v1/time
|
||||||
HTTP 200
|
HTTP 200
|
||||||
GET http://127.0.0.1:5000/api/v1/timezone
|
GET http://127.0.0.1:5000/api/v1/timezone
|
||||||
HTTP 200
|
HTTP 200
|
||||||
|
[Asserts]
|
||||||
|
jsonpath "$.timezone" >= 10
|
||||||
|
jsonpath "$.timezone" <= 12
|
||||||
|
|
||||||
GET http://127.0.0.1:5000/api/v1/message
|
GET http://127.0.0.1:5000/api/v1/message
|
||||||
HTTP 200
|
HTTP 200
|
||||||
GET http://127.0.0.1:5000/api/v1/project
|
GET http://127.0.0.1:5000/api/v1/project
|
||||||
@@ -18,3 +23,6 @@ GET http://127.0.0.1:5000/api/v1/tools
|
|||||||
HTTP 200
|
HTTP 200
|
||||||
[Asserts]
|
[Asserts]
|
||||||
jsonpath "$.tools" count > 5
|
jsonpath "$.tools" count > 5
|
||||||
|
|
||||||
|
GET http://127.0.0.1:5000/api/v1/playing
|
||||||
|
HTTP 200
|
||||||
Reference in New Issue
Block a user