diff --git a/apps/contests/tests_contests.py b/apps/contests/tests_contests.py index 01387f0..fff305c 100644 --- a/apps/contests/tests_contests.py +++ b/apps/contests/tests_contests.py @@ -106,6 +106,26 @@ def test_detail_url_resolves(self) -> None: self.assertEqual(resolved_view_name, expected_view_name) -class ContestViewsTesteCase(TestCase): - # tentar novamente depois - pass +class ContestViewTestCase(TestCase): + def setUp(self) -> None: + now = timezone.now() + self.contest = Contest( + id=1, + title="Test Contest", + description="This is a test contest", + start_time=now, + end_time=now + timedelta(hours=1), + cancelled=False, + ) + + def test_index_view(self) -> None: + response = self.client.get(reverse("contests:index")) + self.assertEqual(response.status_code, 200) + self.assertContains(response, "Test Contest") + + def test_detail_view(self) -> None: + response = self.client.get( + reverse("contests:detail", args=[self.contest.id]) + ) + self.assertEqual(response.status_code, 200) + self.assertContains(response, "Test Contest") diff --git a/apps/problems/tests_problems.py b/apps/problems/tests_problems.py index b5e998e..fbd1b27 100644 --- a/apps/problems/tests_problems.py +++ b/apps/problems/tests_problems.py @@ -117,16 +117,16 @@ def test_admin_fields(self) -> None: class ProblemURLsTestCase(TestCase): def test_detail_url_resolves_to_detail_view(self) -> None: - url = reverse("problems:detail", args=[int]) + url = reverse("problems:detail", args=[1]) resolver = resolve(url) self.assertEqual(resolver.url_name, DetailView) def test_detail_url_reverse(self) -> None: - expected_url = "/problems/int/" + expected_url = "/problems/1/" - generated_url = reverse("problems:detail", args=[int]) + generated_url = reverse("problems:detail", args=[1]) self.assertEqual(generated_url, expected_url)