Refactored tests
This commit is contained in:
+22
-5
@@ -4,7 +4,7 @@ from django.contrib.auth.models import User
|
||||
from interface.models import Ensemble, Project
|
||||
from . import models
|
||||
|
||||
class IntegrationTestCase(AccessTestCase):
|
||||
class LibraryTestCase(AccessTestCase):
|
||||
|
||||
USERS = (
|
||||
{'username': 'admin', 'password': 'secret', 'is_superuser': True, 'is_staff': True},
|
||||
@@ -18,10 +18,10 @@ class IntegrationTestCase(AccessTestCase):
|
||||
)
|
||||
|
||||
PROJECTS = (
|
||||
('Baker St', 'bleeding-gums', -12),
|
||||
('Navy Recruitment Day', 'party-posse', 6),
|
||||
('Barbershop Contest', 'be-sharps', 28),
|
||||
('Open Mic Night', 'bleeding-gums', 1)
|
||||
{'name': 'Baker St', 'ensemble': 'bleeding-gums', 'when': -12},
|
||||
{'name': 'Navy Recruitment Day', 'ensemble': 'party-posse', 'when': 6},
|
||||
{'name': 'Barbershop Contest', 'ensemble': 'be-sharps', 'when': 28},
|
||||
{'name': 'Open Mic Night', 'ensemble': 'bleeding-gums', 'when': 1 },
|
||||
)
|
||||
|
||||
COLLECTIONS = (
|
||||
@@ -33,6 +33,16 @@ class IntegrationTestCase(AccessTestCase):
|
||||
{'name': 'Baby on Board', 'collection': 'ned'},
|
||||
)
|
||||
|
||||
PROTECTED_URLS = (
|
||||
'/collections/1',
|
||||
'/collections/1/add',
|
||||
'/collections/2/works/1',
|
||||
'/collections/2/works/1/edit',
|
||||
'/collections/2/works/1/partset',
|
||||
'/collections/2/works/1/add_to_project',
|
||||
'/collections/2/works/1/upload',
|
||||
)
|
||||
|
||||
@classmethod
|
||||
def setUpTestData(cls):
|
||||
super().setUpTestData()
|
||||
@@ -65,6 +75,13 @@ class IntegrationTestCase(AccessTestCase):
|
||||
def test_integration(self):
|
||||
pass
|
||||
|
||||
def test_get_views(self):
|
||||
|
||||
self.assertAccess({ x: False for x in self.PROTECTED_URLS })
|
||||
|
||||
self.login('admin', 'secret')
|
||||
self.assertAccess({ x: True for x in self.PROTECTED_URLS })
|
||||
|
||||
def test_superuser_access(self):
|
||||
self.login('admin', 'secret')
|
||||
self.assertAccess({
|
||||
|
||||
Reference in New Issue
Block a user