mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-17 05:22:16 +00:00
Minor test futzing
This commit is contained in:
@@ -34,11 +34,13 @@ def get_request_url(url):
|
|||||||
print("Couldn't test url " + pattern)
|
print("Couldn't test url " + pattern)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='function', autouse=True)
|
@pytest.fixture(scope='class', autouse=True)
|
||||||
def run_sample_data(transactional_db, settings, django_db_blocker): # We need stuff setup so we don't get 404 errors everywhere
|
def run_sample_data(django_db_blocker): # We need stuff setup so we don't get 404 errors everywhere
|
||||||
settings.DEBUG = True
|
with django_db_blocker.unblock():
|
||||||
call_command('generateSampleUserData')
|
from django.conf import settings
|
||||||
call_command('generateSampleAssetsData')
|
settings.DEBUG = True
|
||||||
|
call_command('generateSampleData')
|
||||||
|
settings.DEBUG = False
|
||||||
|
|
||||||
|
|
||||||
def test_unauthenticated(client): # Nothing should be available to the unauthenticated
|
def test_unauthenticated(client): # Nothing should be available to the unauthenticated
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ from django.utils import timezone
|
|||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope='class', autouse=True)
|
@pytest.fixture(scope='class', autouse=True)
|
||||||
def run_sample_data(settings, django_db_blocker): # We need stuff setup so we don't get 404 errors everywhere
|
def run_sample_data(django_db_blocker): # We need stuff setup so we don't get 404 errors everywhere
|
||||||
with django_db_blocker.unblock():
|
with django_db_blocker.unblock():
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
settings.DEBUG = True
|
settings.DEBUG = True
|
||||||
@@ -26,6 +26,7 @@ def run_sample_data(settings, django_db_blocker): # We need stuff setup so we d
|
|||||||
|
|
||||||
class TestAccess():
|
class TestAccess():
|
||||||
def test_basic_access(client):
|
def test_basic_access(client):
|
||||||
|
client.logout()
|
||||||
assert client.login(username="basic", password="basic")
|
assert client.login(username="basic", password="basic")
|
||||||
|
|
||||||
url = reverse('asset_list')
|
url = reverse('asset_list')
|
||||||
@@ -55,6 +56,7 @@ class TestAccess():
|
|||||||
|
|
||||||
|
|
||||||
def test_keyholder_access(client):
|
def test_keyholder_access(client):
|
||||||
|
client.logout()
|
||||||
assert client.login(username="keyholder", password="keyholder")
|
assert client.login(username="keyholder", password="keyholder")
|
||||||
|
|
||||||
url = reverse('asset_list')
|
url = reverse('asset_list')
|
||||||
|
|||||||
Reference in New Issue
Block a user