From db218cb8c21cabbaeeba1a72b6ca535aa7bcfb32 Mon Sep 17 00:00:00 2001 From: Jimmy Date: Thu, 13 Jan 2022 03:13:04 +0000 Subject: [PATCH] Add server test --- Pipfile | 2 +- app/test/test_server.py | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 app/test/test_server.py diff --git a/Pipfile b/Pipfile index 73fe762..dc0e2e5 100644 --- a/Pipfile +++ b/Pipfile @@ -24,5 +24,5 @@ mypy = "*" python_version = "3.9" [scripts] -test = "pytest app/test/test_main.py -s" +test = "pytest app/test/test_auth.py app/test/test_server.py -W ignore::DeprecationWarning -s" dev = "uvicorn app.main:app --reload" diff --git a/app/test/test_server.py b/app/test/test_server.py new file mode 100644 index 0000000..e5ec86d --- /dev/null +++ b/app/test/test_server.py @@ -0,0 +1,21 @@ +#curl -i -X POST http://localhost:8000/token -H "Content-Type: application/x-www-form-urlencoded" -d "username=johndoe&password=secret" + +# curl -X 'GET' \ +# 'http://localhost:8000/users/me/' \ +# -H 'accept: application/json' \ +# -H 'Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiJqb2huZG9lIiwiZXhwIjoxNjMxNDQ4MjQ1fQ.DrM92jgRiry0uXBXn-61rRehATW4zDhHUWoGR6lv6Us' +from fastapi import FastAPI +from fastapi.testclient import TestClient +import docker + +from server import * + +app = FastAPI() +app.include_router(router) +testclient = TestClient(app) + +def test_start(): + #response = testclient.post("/server/minecraft/start") + #assert response.status_code == 200 + pass +