-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write basic unit tests for RO/TO model
- Loading branch information
1 parent
d5de527
commit 7b87017
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
) |