Added delete-user route

This commit is contained in:
Mawoka
2022-04-18 16:13:51 +02:00
parent 31094c9a24
commit 0b85aa9275
5 changed files with 33 additions and 12 deletions
+1 -1
View File
@@ -3,7 +3,7 @@ import pytest
from classquiz.kahoot_importer.get import get
@pytest.mark.order("last")
@pytest.mark.order(-2)
@pytest.mark.asyncio
async def test_get():
await get("1f95eb0b-fcf4-4db2-879b-5418ef75116b")
+1 -1
View File
@@ -4,7 +4,7 @@ from classquiz.kahoot_importer.search import search
@pytest.mark.asyncio
@pytest.mark.order("last")
@pytest.mark.order(-2)
async def test_search():
res = await search(query="Python", limit=100)
assert len(res.entities) == 100
+13
View File
@@ -359,3 +359,16 @@ class TestQuiz:
ValueStorage.imported_quizzes.append(resp.json()["id"])
resp = test_client.post("/api/v1/quiz/import/1f95eb0bdassdadasdas", cookies={"access_token": token})
assert resp.text == '"quiz not found"'
class TestDeleteUser:
@pytest.mark.asyncio
async def test_delete_user(self, test_client):
resp = test_client.post(
"/api/v1/users/token/cookie", data={"username": test_user_email, "password": test_user_password}
)
token = resp.cookies["access_token"]
resp = test_client.delete(
"/api/v1/users/me", cookies={"access_token": token}, json={"password": test_user_password}
)
assert resp.status_code == 200