Skip to content

Commit

Permalink
teste basicos. #1
Browse files Browse the repository at this point in the history
  • Loading branch information
LamequeFernandes committed Aug 30, 2022
1 parent 89a7687 commit 6ab779a
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
Empty file added test/__init__.py
Empty file.
58 changes: 58 additions & 0 deletions test/tests_professor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
from fastapi.testclient import TestClient

from main import app


client = TestClient(app, base_url="http://localhost")


def test_post_professor_status():
response = client.post(
url="/professor/99"
)
assert response.status_code == 405


def test_post_professor_json():
response = client.post(
url="/professor/",
json={ "id": 1000,
"nome": "Joãozinho",
"email": "[email protected]",
"senha": "bekoajnsd",
"numero_telefone": "81556698899",
"dt_nascumento": "1985-08-02 17:41:02.621282",
"created_at": "2022-08-02 17:41:02.621282",
"matricula": 150123654,
"is_coordenador": False}
)
assert response.status_code == 201
assert response.json() == {
"id": 1000,
"nome": "Joãozinho",
"email": "[email protected]",
"senha": "bekoajnsd",
"numero_telefone": "81556698899",
"dt_nascimento": None,
"created_at": "2022-08-02T17:41:02.621282",
"matricula": 150123654,
"is_coordenador": False
}


def test_post_professor_json_url():
response = client.post(
url="/professor",
json={ "nome": "Elaine",
"email": "[email protected]",
"senha": "bekoajnasdasd21312sd",
"numero_telefone": "815566988499",
"dt_nascumento": "1985-08-02 17:41:02.621282",
"created_at": "2022-08-02 17:41:02.621282",
"matricula": 43120123654,
"is_coordenador": False}
)
assert response.status_code == 307



0 comments on commit 6ab779a

Please sign in to comment.