-
Notifications
You must be signed in to change notification settings - Fork 268
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 Stakeholder model
- Loading branch information
1 parent
40b1721
commit 4cf70f0
Showing
2 changed files
with
40 additions
and
1 deletion.
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
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, Stakeholder | ||
|
||
from tprm.models import Entity | ||
|
||
from ebios_rm.tests.fixtures import * | ||
|
||
|
||
@pytest.mark.django_db | ||
class TestStakeholder: | ||
@pytest.mark.usefixtures( | ||
"basic_ebios_rm_study_fixture", | ||
) | ||
def test_create_stakeholder_basic(self): | ||
study = EbiosRMStudy.objects.get(name="test study") | ||
entity = Entity.objects.create(name="Entity") | ||
stakeholder = Stakeholder.objects.create( | ||
entity=entity, | ||
category=Stakeholder.Category.SUPPLIER, | ||
) | ||
stakeholder.ebios_rm_studies.add(study) | ||
|
||
assert stakeholder in study.stakeholders.all() | ||
assert stakeholder.entity == entity | ||
assert stakeholder.category == Stakeholder.Category.SUPPLIER | ||
|
||
assert stakeholder.current_criticality == 0 | ||
assert stakeholder.residual_criticality == 0 |