def test_calcualate_remaining_time_for_delivery_pickup(): dp = DeliveryProvider() expected_arrival_time = "12:43 pm" expected_remaining_time = "32 minutes and 41 seconds" assert dp.calcualate_remaining_time_for_delivery_pickup( expected_arrival_time ) == expected_remaining_time, "Calculation for the remaining time for delivery driver's arrival failed!"
def test_set_delivery_provider(): delivery_providers = ["UberEats", "SkipTheDishes", "Foodora"] for dp_name in delivery_providers: dp = DeliveryProvider() assert dp.set_deliver_provider( dp_name ) == dp_name, "Delivery provider is not selected as specified!"
def test_check_driver_arrival_time_status(): order = Orders(10) staff = RestaurantStaff(12) dp = DeliveryProvider() expected_time = "12:43 pm" assert dp.check_driver_arrival_time_status( order.order_id, staff.employee_id ) == expected_time, "Arrival time not available for tracking by restaurant staff!"
def test_track_order(): valid_order_status_messsages = [ "Order received", "Order accepted", "Order being delivered" ] fake_order_id = 10 for message in valid_order_status_messsages: dp = DeliveryProvider() assert dp.track_order( fake_order_id) == message, "Unable to track the order!"
def test_cancel_order(): valid_order_status_messsages = [ "Order cancelled", "Unable to cancel order" ] fake_order_id = 10 for message in valid_order_status_messsages: dp = DeliveryProvider() assert dp.cancel_order( fake_order_id ) == message, "No confirmation of cancellation received!"
def test_add_cart_items_to_delivery_provider(): cart_items = ["Octopus", "Lobster"] dp = DeliveryProvider() assert dp.add_cart_items_to_delivery_provider( cart_items ) == True, "Unable to add cart items to the delivery provider!"
def test_deliver_with_uber_eats_button(): expected_button_text = "Order with UberEats" dp = DeliveryProvider() assert dp.generate_button_for_delivery == expected_button_text, "Invalid button text specified!"
def test_currently_configured_delivery_provider(): invalid_delivery_providers = ["SkipTheDishes", "Foodora", "Instacart"] for dp_name in invalid_delivery_providers: dp = DeliveryProvider() assert dp.get_delivery_provider( dp_name) == True, "Invalid delivery provider configured!"