Add server test

This commit is contained in:
Jimmy 2022-01-13 03:13:04 +00:00
parent fd5fc0a85d
commit db218cb8c2
2 changed files with 22 additions and 1 deletions

View File

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

21
app/test/test_server.py Normal file
View File

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