-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtest_main.py
55 lines (45 loc) · 1.83 KB
/
test_main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
from fastapi import FastAPI
from fastapi.testclient import TestClient
from typing import Optional
from fastapi import FastAPI
from datetime import datetime
from typing import List, Optional
from fastapi.testclient import TestClient
from main import app
client = TestClient(app)
def test_create_bookTicket():
response = client.post("/bookTicket",
json={"userName": "kevin", "userPhoneNumber": "14567", "movieName": "The Foo Barters","movieStartTime":"2017-06-01 12:22","numTickets": "1" },
)
assert response.status_code == 422
def test_create_updateMovieSlotForTicket():
response = client.post("/updateMovieSlotForTicket",
json = {"ticketId": "17839", "newMovie": "Avatar", "newStartTime": "2017-06-01 12:22"}
)
assert response.status_code == 422
def test_create_getAllTicketsForMovieSlot():
response = client.post("/getAllTicketsForMovieSlot",
json = {"movieName": "17839", "movieStartTime": "2017-06-01 12:22"}
)
assert response.status_code == 422
def test_create_cancelTicket():
response = client.post("/cancelTicket",
json = {"ticketId": "1744339"}
)
assert response.status_code == 422
def test_create_getUserDetailsByTicketId():
response = client.post("/getUserDetailsByTicketId",
json = {"ticketId": "17439"}
)
assert response.status_code == 422
def test_create_scheduleMovie():
response = client.post("/scheduleMovie",
json = {"slotName": "Avatar", "slotDescription": "must watch",
"startTime": "2017-06-01 12:22","endTime": "2017-06-01 12:22", "slotType": "Concert", "genre": "Action"}
)
assert response.status_code == 422
def test_create_getAllMovieSlotsByGenre():
response = client.post("/getAllMovieSlotsByGenre",
json = {"genre": ""}
)
assert response.status_code == 422