start testing
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
|
||||
import pytest
|
||||
from rapids.models import Abnormality, Exam
|
||||
|
||||
#@pytest.mark.django_db
|
||||
def test_create_abnormality(db):
|
||||
abnormality = Abnormality.objects.create(name="Abnorm")
|
||||
assert abnormality.name == "Abnorm"
|
||||
|
||||
@pytest.fixture
|
||||
def create_exam(db):
|
||||
return Exam.objects.create(name="test exam")
|
||||
|
||||
def test_exam_creation(create_exam):
|
||||
exams = Exam.objects.filter(name="test exam")
|
||||
assert exams.exists()
|
||||
|
||||
exam = exams.first()
|
||||
|
||||
assert exam.time_limit == 35 * 60
|
||||
@@ -0,0 +1,12 @@
|
||||
import pytest
|
||||
#from django.contrib.auth.models import User
|
||||
from django.urls import reverse
|
||||
|
||||
@pytest.fixture
|
||||
def create_superuser(db, django_user_model):
|
||||
return django_user_model.objects.create_superuser("admin", "ross@xkjq.uk", "adminpassword")
|
||||
|
||||
def test_index(client, create_superuser):
|
||||
client.login(username="admin", password="adminpassword")
|
||||
response = client.get(reverse('rapids:index'))
|
||||
assert response.status_code == 200
|
||||
Executable
+16
@@ -0,0 +1,16 @@
|
||||
from django.test import TestCase, Client
|
||||
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Create your tests here.
|
||||
|
||||
|
||||
#class TestUrls(TestCase):
|
||||
# def setUp(self):
|
||||
# User.objects.create_superuser("admin", "ross@xkjq.uk", "adminpassword")
|
||||
#
|
||||
# def test_index(self):
|
||||
# self.client.login(username="admin", password="adminpassword")
|
||||
# response = self.client.get(reverse('rapids:index'))
|
||||
# self.assertEqual(response.status_code, 200)
|
||||
Reference in New Issue
Block a user