Skip to content

Commit

Permalink
Write basic unit tests for RO/TO model
Browse files Browse the repository at this point in the history
  • Loading branch information
nas-tabchiche committed Dec 2, 2024
1 parent d5de527 commit 7b87017
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions backend/ebios_rm/tests/test_ro_to.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import pytest
from ebios_rm.models import EbiosRMStudy, FearedEvent, ROTO

from ebios_rm.tests.fixtures import *


@pytest.mark.django_db
class TestROTO:
@pytest.mark.usefixtures(
"basic_ebios_rm_study_fixture", "basic_feared_event_fixture"
)
def test_create_roto_basic(self):
roto = ROTO.objects.create(
risk_origin=ROTO.RiskOrigin.STATE,
target_objective="test target objectives",
ebios_rm_study=EbiosRMStudy.objects.get(name="test study"),
)
roto.feared_events.set(FearedEvent.objects.filter(name="test feared event"))

assert roto.risk_origin == "state"
assert roto.target_objective == "test target objectives"

assert roto.feared_events.count() == 1
assert roto.feared_events.filter(name="test feared event").exists()
assert (
roto.ebios_rm_study
== FearedEvent.objects.get(name="test feared event").ebios_rm_study
)

0 comments on commit 7b87017

Please sign in to comment.