|
@@ -9,7 +9,7 @@ from django.test.client import Client
|
|
|
from django.contrib.auth.models import User, Permission
|
|
|
|
|
|
# Application imports
|
|
|
from conntrackt.models import Project
|
|
|
from conntrackt.models import Project, Location
|
|
|
|
|
|
|
|
|
class ViewTest(TestCase):
|
|
@@ -65,7 +65,19 @@ class IndexViewTest(ViewTest):
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
response = self.client.get(reverse("index"))
|
|
|
|
|
|
self.assertContains(response, "Currently there are no projects defined in the database. Use the administration pages in order to add a new project.")
|
|
|
self.assertContains(response, "There are no projects defined.")
|
|
|
|
|
|
def test_no_locations(self):
|
|
|
"""
|
|
|
Tests the index view when no locations are defined.
|
|
|
"""
|
|
|
|
|
|
Location.objects.all().delete()
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
response = self.client.get(reverse("index"))
|
|
|
|
|
|
self.assertContains(response, "There are no locations defined.")
|
|
|
|
|
|
def test_projects_available(self):
|
|
|
"""
|
|
@@ -80,6 +92,19 @@ class IndexViewTest(ViewTest):
|
|
|
self.assertContains(response, "Test Project 1")
|
|
|
self.assertContains(response, "Test Project 2")
|
|
|
|
|
|
def test_locations_available(self):
|
|
|
"""
|
|
|
Tests if locations are show or not.
|
|
|
"""
|
|
|
|
|
|
self.client.login(username="fullperms", password="fullperms")
|
|
|
|
|
|
response = self.client.get(reverse("index"))
|
|
|
|
|
|
self.assertQuerysetEqual(response.context["locations"], ["<Location: Test Location 1>", "<Location: Test Location 2>"])
|
|
|
self.assertContains(response, "Test Location 1")
|
|
|
self.assertContains(response, "Test Location 2")
|
|
|
|
|
|
|
|
|
class ProjectViewTest(ViewTest):
|
|
|
|