Skip to content
Snippets Groups Projects
Commit 92ebee2c authored by Deaktivert bruker's avatar Deaktivert bruker
Browse files

greg.tests: convert OrganizationalUnit model tests to pytest

Fixes: GREG-14
parent 6ef28f31
No related branches found
No related tags found
1 merge request!11greg.tests: migrate to pytest test runner
import pytest
from greg.models import OrganizationalUnit
@pytest.mark.django_db
def test_set_parent():
parent = OrganizationalUnit.objects.create(orgreg_id="parent")
child = OrganizationalUnit.objects.create(orgreg_id="child", parent=parent)
assert list(OrganizationalUnit.objects.filter(parent__id=parent.id)) == [child]
......@@ -89,20 +89,3 @@ class ConsentModelTest(TestCase):
person.consents.add(
consent, through_defaults={"consent_given_at": "2021-06-20"}
)
class OrganizationalUnitTest(TestCase):
def test_set_parent_for_unit(self):
parent = OrganizationalUnit.objects.create(
orgreg_id="12345", name_en="Parent unit", name_nb="Foreldreseksjon"
)
child = OrganizationalUnit.objects.create(
orgreg_id="123456",
name_en="Child unit",
name_nb="Barneseksjon",
parent=parent,
)
query_result = OrganizationalUnit.objects.filter(parent__id=parent.id)
self.assertEqual(1, len(query_result))
self.assertIn(child, query_result)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment