def test_add_jobs(): itinerary = Itinerary(45, "2222") move_job = itinerary.move_to(123) current_job = itinerary.current_job assert move_job == current_job assert move_job is not None assert current_job is not None assert itinerary.next_jobs == [] assert itinerary.jobs_to_complete == [current_job] assert not itinerary.is_completed() itinerary.pickup("1212") assert len(itinerary.next_jobs) == 1 assert len(itinerary.jobs_to_complete) == 2 assert itinerary.current_job == current_job assert not itinerary.is_completed() itinerary.dropoff("333") assert len(itinerary.next_jobs) == 2 assert len(itinerary.jobs_to_complete) == 3 assert itinerary.current_job == current_job assert not itinerary.is_completed() itinerary.wait(444) assert len(itinerary.next_jobs) == 3 assert len(itinerary.jobs_to_complete) == 4 assert itinerary.current_job == current_job assert not itinerary.is_completed() with pytest.raises(Exception): itinerary.add_job("Not a Base")
def test_job_types(): created_at = 2 itinerary = Itinerary(created_at, "343433") itinerary.created_at = created_at job = itinerary.pickup("34") assert job.name() == "pickup" assert job.is_pickup() assert job.itinerary_id == itinerary.id job = itinerary.dropoff("33") assert job.name() == "dropoff" assert job.is_dropoff() assert not job.is_pickup() assert job.itinerary_id == itinerary.id job = itinerary.move_to("33") assert job.name() == "move_to" assert job.is_move_to() assert not job.is_dropoff() assert not job.is_pickup() assert job.itinerary_id == itinerary.id job = itinerary.wait("33") assert job.name() == "wait" assert job.is_wait() assert not job.is_move_to() assert not job.is_dropoff() assert not job.is_pickup() assert job.itinerary_id == itinerary.id