def test_search_order_incorrect_input(): sys = System() order0 = sys.newOrder() order1 = sys.newOrder() order2 = sys.newOrder() with pytest.raises(UserError) as err: sys.searchOrder(32) assert 'OrderID not exist in the system' in str(err.value)
def test_search_order_correct_input(): sys = System() order0 = sys.newOrder() order1 = sys.newOrder() order2 = sys.newOrder() assert sys.searchOrder(1) == order1
def test_orders_overview(): sys = System() order1 = sys.newOrder() order2 = sys.newOrder() order3 = sys.newOrder() assert sys.ordersOverview() == [order1, order2, order3]
def test_checkOrderStatus_blank(): sys = System() sys.newOrder() assert sys.checkOrderStatus(0) == None
def test_checkoutorder(): sys = System() order = sys.newOrder() price = sys.checkoutOrder(order) assert sys.checkOrderStatus(0) == 'cooking' assert price == order.price
def test_updateOrderStatus(): sys = System() sys.newOrder() sys.updateOrderStatus(0, 'cooking') assert sys.checkOrderStatus(0) == 'cooking'
def test_newOrder(): sys = System() sys.newOrder() assert len(sys.orders) == 1 assert sys.orders[0].orderID == 0