예제 #1
0
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)
예제 #2
0
def test_search_order_correct_input():
    sys = System()
    order0 = sys.newOrder()
    order1 = sys.newOrder()
    order2 = sys.newOrder()
    assert sys.searchOrder(1) == order1
예제 #3
0
def test_orders_overview():
    sys = System()
    order1 = sys.newOrder()
    order2 = sys.newOrder()
    order3 = sys.newOrder()
    assert sys.ordersOverview() == [order1, order2, order3]
예제 #4
0
def test_checkOrderStatus_blank():
    sys = System()
    sys.newOrder()
    assert sys.checkOrderStatus(0) == None
예제 #5
0
def test_checkoutorder():
    sys = System()
    order = sys.newOrder()
    price = sys.checkoutOrder(order)
    assert sys.checkOrderStatus(0) == 'cooking'
    assert price == order.price
예제 #6
0
def test_updateOrderStatus():
    sys = System()
    sys.newOrder()
    sys.updateOrderStatus(0, 'cooking')
    assert sys.checkOrderStatus(0) == 'cooking'
예제 #7
0
def test_newOrder():
    sys = System()
    sys.newOrder()
    assert len(sys.orders) == 1
    assert sys.orders[0].orderID == 0