def test_update_succeeds_when_event_item_has_same_id( self, event_item, updated_event_item): saved_event_item = self.repository.save(event_item) updated_event_item.id = saved_event_item.id self.repository.save(updated_event_item) assert get_public_vars(self.repository.event_items[ saved_event_item.id]) == get_public_vars(updated_event_item)
def test_update_succeeds_when_user_has_same_id(self, user, updated_user): saved_user = self.repository.save(user) user_id = saved_user.id updated_user.id = user_id self.repository.save(updated_user) assert get_public_vars( self.repository.users[user_id]) == get_public_vars(updated_user)
def test_update_succeeds_when_event_has_exist_id(self, event, updated_event): saved_event = self.repository.save(event) event_id = saved_event.id updated_event.id = event_id self.repository.save(updated_event) assert get_public_vars( self.repository.events[event_id]) == get_public_vars(updated_event)
def test_update_succeeds_when_candidate_has_id(self, candidate, updated_candidate): saved_candidate = self.repository.save(candidate) candidate_id = saved_candidate.id updated_candidate.id = candidate_id self.repository.save(updated_candidate) assert get_public_vars( self.repository.candidates[candidate_id]) == get_public_vars( updated_candidate)
def test_return_user_when_target_id_exists(self): assert get_public_vars( self.repository.find_by_id(1)) == get_public_vars( self.repository.users[1])
def test_succeeds_when_user_has_no_id(self, user): saved_user = self.repository.save(user) assert get_public_vars( self.repository.users[saved_user.id]) == get_public_vars(user)
def test_succeeds_initialization_with_valid_args(self, valid_args, expected): candidate = Candidate(**valid_args) assert get_public_vars(candidate) == expected
def test_succeeds_initialization_with_valid_args(self, valid_args, expected): event_item = EventItem(**valid_args) assert get_public_vars(event_item) == expected
def test_create_succeeds_when_event_has_no_id(self, event): saved_event = self.repository.save(event) assert get_public_vars( self.repository.events[saved_event.id]) == get_public_vars(event)
def test_return_event_item_when_target_id_exists(self): assert get_public_vars( self.repository.find_by_id(1)) == get_public_vars( self.repository.event_items[1])
def test_succeeds_when_event_item_has_no_id(self, event_item): saved_event_item = self.repository.save(event_item) assert get_public_vars(self.repository.event_items[ saved_event_item.id]) == get_public_vars(event_item)
def test_succeeds_when_candidate_has_no_id(self, candidate): saved_candidate = self.repository.save(candidate) assert get_public_vars(self.repository.candidates[ saved_candidate.id]) == get_public_vars(candidate)