def test_invalid_modify_delivery_address():
    address = Address('100 John Rd', 'Toronto', 'ON', 'L5M 7U6')
    order = Order(100)
    order.set_order_type('delivery')
    order.set_delivery_address(address)
    order.set_order_status('out for delivery')

    new_address = Address('200 John Rd', 'Toronto', 'ON', 'L5M 7U6')
    assert order.modify_delivery_order(new_address) is False, "Should not be able to modify delivery order if " \
                                                              "status is out for delivery"
def test_cancel_order_in_progress():
    delivery_address = Address('100 John Rd', 'Toronto', 'ON', 'M5R 7U6')
    order = Order('100')
    order.set_order_status('in-progress')
    assert order.cancel_order() is False, "Should not be able to cancel order if in-progress"
def test_cancel_order():
    order = Order('100')
    order.set_order_type('confirmed')
    assert order.cancel_order(), "Should be able to cancel order if not in-progress"
def test_invalid_payment_on_delivery():
    order = Order(49)
    order.set_order_type('delivery')

    assert order.allow_payment_on_delivery() is False, "Payment on delivery should not be allowed if " \
                                                       "order amount is less than 50"
def test_valid_payment_on_delivery():
    order = Order(100)
    order.set_order_type('delivery')

    assert order.allow_payment_on_delivery(
    ), "Payment on delivery should be allowed if order amount is more than 50"
def test_set_order_type():
    order = Order(100)
    order.set_order_type('delivery')

    assert order.order_type == 'delivery', "Should be able to set order type"
def test_place_invalid_delivery_order_amount():
    order = Order(5)
    order.set_order_type('delivery')
    assert order.place_delivery_order(
        order
    ) is False, "Should not be able to place delivery order of amount 5"
def test_place_valid_delivery_order_amount():
    order = Order(100)
    order.set_order_type('delivery')
    assert order.place_delivery_order(
        order), "Should be able to place delivery order of amount 100"