def test_change_from_draft_to_finished(): event = Event(name="Tallinn Meeting", description="Meeting friends in Tallinn", place="Livalia, 23", date=datetime.today().weekday()) with pytest.raises(InvalidTranstionStatus): event.change_status_to(EventStatus.FINISHED) assert event.status == EventStatus.DRAFT
def test_change_from_status1_to_status2_unsuccess(from_status, to_status, expected_exception): # given event = Event(name="Tallinn Meeting", description="Meeting friends in Tallinn", place="Livalia, 23", date=datetime.today().weekday(), status=from_status) # when with pytest.raises(expected_exception): event.change_status_to(to_status)
def test_change_from_status1_to_status2_success(from_status, to_status, expected): # given event = Event(name="Tallinn Meeting", description="Meeting friends in Tallinn", place="Livalia, 23", date=datetime.today().weekday(), status=from_status) if type(expected) == type: # when with pytest.raises(expected): event.change_status_to(to_status) else: # when event.change_status_to(to_status) # assert assert event.status == expected