def test_get_redirect_success_url_when_exist(self): expected_url = reverse( "education_group_read", args=[self.education_group_year.pk, self.education_group_year.id]) result = _get_success_redirect_url(self.education_group_year, self.education_group_year) self.assertEqual(result, expected_url)
def test_get_redirect_success_url_when_current_viewed_has_been_deleted(self): current_viewed = self.education_group_year_in_future[-1] current_viewed.delete() # Expected URL is the latest existing [-2] expected_url = reverse("education_group_read", args=[self.education_group_year_in_future[-2].pk, self.education_group_year_in_future[-2].pk]) result = _get_success_redirect_url(current_viewed, current_viewed) self.assertEqual(result, expected_url)