fix rcr tests

This commit is contained in:
Ross
2024-02-26 21:24:48 +00:00
parent f4d2ab85f9
commit 8299efabf9
2 changed files with 6 additions and 45 deletions
+6 -2
View File
@@ -44,7 +44,7 @@ def create_oncology_user(db, django_user_model, create_groups):
@pytest.fixture
def create_item(db, create_radiology_category, create_oncology_category, create_outcome, create_outcome_reason, create_level):
return Item.objects.create(
item = Item.objects.create(
name="Test Item",
description="Test Description",
content_type="Test Content Type",
@@ -55,7 +55,7 @@ def create_item(db, create_radiology_category, create_oncology_category, create_
review_link="Test Review Link",
review_link_password="Test Password",
rcr_platform_id="Test Platform ID",
radiology_category=create_radiology_category,
#radiology_category=create_radiology_category,
oncology_category=create_oncology_category,
outcome=create_outcome,
outcome_reason=create_outcome_reason,
@@ -66,6 +66,10 @@ def create_item(db, create_radiology_category, create_oncology_category, create_
completed_oncology=True
)
item.level.add(create_level)
item.radiology_categories.add(create_radiology_category)
return item
@pytest.fixture
def create_level(db):
return Level.objects.create(name="Test Level")
-43
View File
@@ -4,51 +4,8 @@ from django.contrib.auth import get_user_model
from rcr.models import Item, Level, RadiologyCategory, OncologyCategory, Outcome, OutcomeReason
import pytest
@pytest.fixture
def create_level(db):
return Level.objects.create(name="Test Level")
@pytest.fixture
def create_radiology_category(db):
return RadiologyCategory.objects.create(name="Test Radiology Category")
@pytest.fixture
def create_oncology_category(db):
return OncologyCategory.objects.create(name="Test Oncology Category")
@pytest.fixture
def create_outcome(db):
return Outcome.objects.create(name="Test Outcome")
@pytest.fixture
def create_outcome_reason(db):
return OutcomeReason.objects.create(reason="Test Outcome Reason")
@pytest.fixture
def create_item(db, create_level, create_radiology_category, create_oncology_category, create_outcome, create_outcome_reason):
item = Item.objects.create(
name="Test Item",
description="Test Description",
content_type="Test Content Type",
number_of_items=1,
specialty="Test Specialty",
access_count=1,
targeted_to_group="Test Group",
review_link="Test Review Link",
review_link_password="Test Password",
rcr_platform_id="Test Platform ID",
radiology_category=create_radiology_category,
oncology_category=create_oncology_category,
outcome=create_outcome,
outcome_reason=create_outcome_reason,
outcome_free_text="Test Outcome Free Text",
comments="Test Comments",
needs_review=True,
completed_radiology=True,
completed_oncology=True
)
item.level.add(create_level)
return item
def test_item_creation(create_item):
assert Item.objects.count() == 1