feat: change entire downloads
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from django.test import TestCase
|
||||
from django.urls import reverse
|
||||
|
||||
from apps.pages.models import DownloadItem, FAQEntry
|
||||
from apps.pages.models import FAQEntry
|
||||
|
||||
|
||||
class HomeViewTest(TestCase):
|
||||
@@ -24,42 +24,6 @@ class AboutViewTest(TestCase):
|
||||
self.assertTemplateUsed(response, "pages/about.html")
|
||||
|
||||
|
||||
class DownloadsViewTest(TestCase):
|
||||
def setUp(self):
|
||||
DownloadItem.objects.create(
|
||||
name="Radiuma Desktop",
|
||||
platform="windows",
|
||||
version="1.0",
|
||||
download_url="https://example.com/windows",
|
||||
is_active=True,
|
||||
)
|
||||
DownloadItem.objects.create(
|
||||
name="Radiuma Desktop",
|
||||
platform="macos",
|
||||
version="Coming Soon",
|
||||
download_url="#",
|
||||
is_active=False,
|
||||
)
|
||||
|
||||
def test_downloads_returns_200(self):
|
||||
response = self.client.get(reverse("pages:downloads"))
|
||||
self.assertEqual(response.status_code, 200)
|
||||
|
||||
def test_downloads_uses_correct_template(self):
|
||||
response = self.client.get(reverse("pages:downloads"))
|
||||
self.assertTemplateUsed(response, "pages/downloads.html")
|
||||
|
||||
def test_downloads_context_has_platform_keys(self):
|
||||
response = self.client.get(reverse("pages:downloads"))
|
||||
self.assertIn("windows_items", response.context)
|
||||
self.assertIn("macos_items", response.context)
|
||||
self.assertIn("linux_items", response.context)
|
||||
|
||||
def test_windows_item_in_context(self):
|
||||
response = self.client.get(reverse("pages:downloads"))
|
||||
self.assertEqual(response.context["windows_items"].count(), 1)
|
||||
|
||||
|
||||
class FAQViewTest(TestCase):
|
||||
def setUp(self):
|
||||
FAQEntry.objects.create(
|
||||
@@ -107,8 +71,12 @@ class NavigationContextTest(TestCase):
|
||||
reverse("pages:about"),
|
||||
reverse("pages:faq"),
|
||||
reverse("pages:contact"),
|
||||
reverse("pages:downloads"),
|
||||
reverse("products:overview"),
|
||||
]
|
||||
for url in urls:
|
||||
response = self.client.get(url)
|
||||
self.assertIn("nav_main_products", response.context, f"Missing nav_main_products at {url}")
|
||||
self.assertIn(
|
||||
"nav_main_products",
|
||||
response.context,
|
||||
f"Missing nav_main_products at {url}",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user