-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtest02.py
114 lines (107 loc) · 4.09 KB
/
test02.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
# Written by XJ
# virtual clients for back-end testing using pytest
from inventory import *
from restaurant_system1 import *
from order import *
from food import *
from construction import *
import pytest
import pickle
####### Staff interface test1 - Serve Orders
def test_serve_1(): # order has single main
system.refill_inventory("sesame bun", 2)
system.refill_inventory("beef patty", 1)
main = []
other = []
main.append(hamburger)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"
def test_serve_2(): # order has single main and side/drink
system.refill_inventory("sesame bun", 2)
system.refill_inventory("beef patty", 1)
system.refill_inventory("fries", 150)
main = []
other = []
main.append(hamburger)
other.append(large_fries)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"
def test_serve_3(): # order has single main and multiple side/drink
system.refill_inventory("sesame bun", 2)
system.refill_inventory("beef patty", 1)
system.refill_inventory("fries", 150)
system.refill_inventory("nugget", 3)
main = []
other = []
main.append(hamburger)
other.append(large_fries)
other.append(three_nuggets)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"
def test_serve_4(): # order has single side/drink
system.refill_inventory("fries", 150)
main = []
other = []
other.append(large_fries)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"
def test_serve_5(): # order has mulitple side/drink
system.refill_inventory("fries", 150)
system.refill_inventory("apple juice", 450)
main = []
other = []
other.append(large_fries)
other.append(medium_apple_juice)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"
def test_serve_6(): # a complex order
system.refill_inventory("fries", 150)
system.refill_inventory("apple juice", 450)
system.refill_inventory("cheese slice", 2)
system.refill_inventory("sesame bun", 7)
system.refill_inventory("beef patty", 4)
system.refill_inventory("pepper", 2)
system.refill_inventory("nugget", 3)
system.refill_inventory("white wrap", 100)
system.refill_inventory("chicken patty", 2)
main = []
other = []
main.append(cheeseburger)
main.append(double_cheeseburger)
main.append(hamburger)
main.append(double_chicken_wrap)
other.append(large_fries)
other.append(three_nuggets)
other.append(medium_apple_juice)
o = system.make_order(main, other)
assert system.check_order_status(o.orderid) == "preparing your order"
assert o in system.staff_orders
system.serve_order(o.orderid)
assert o in system.orders
assert (o in system.staff_orders) == False
assert system.check_order_status(o.orderid) == "your order is ready"