diff options
Diffstat (limited to '')
-rw-r--r-- | ctrack/caf/migrations/0009_auto_20200826_1255.py | 30 | ||||
-rw-r--r-- | ctrack/organisations/tests/test_models.py | 28 | ||||
-rw-r--r-- | pytest.ini | 3 |
3 files changed, 57 insertions, 4 deletions
diff --git a/ctrack/caf/migrations/0009_auto_20200826_1255.py b/ctrack/caf/migrations/0009_auto_20200826_1255.py new file mode 100644 index 0000000..6611b59 --- /dev/null +++ b/ctrack/caf/migrations/0009_auto_20200826_1255.py @@ -0,0 +1,30 @@ +# Generated by Django 2.2.12 on 2020-08-26 12:55 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('organisations', '0011_auto_20200531_1441'), + ('caf', '0008_auto_20200814_1318'), + ] + + operations = [ + migrations.AlterField( + model_name='applicablesystem', + name='essential_service', + field=models.CharField(default='NA', help_text='Description of the essential service which the system suppports.', max_length=255, verbose_name='Essential Service'), + ), + migrations.CreateModel( + name='EssentialService', + fields=[ + ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(max_length=256)), + ('description', models.CharField(max_length=512)), + ('organisation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='organisations.Organisation')), + ('systems', models.ManyToManyField(to='caf.ApplicableSystem')), + ], + ), + ] diff --git a/ctrack/organisations/tests/test_models.py b/ctrack/organisations/tests/test_models.py index 8287e97..09d4f12 100644 --- a/ctrack/organisations/tests/test_models.py +++ b/ctrack/organisations/tests/test_models.py @@ -1,8 +1,14 @@ +import random + import pytest + from slugify import slugify from ctrack.organisations.models import IncidentReport, Organisation +from ctrack.caf.models import CAF, Grading +from ctrack.caf.tests.factories import ApplicableSystemFactory from ctrack.caf.models import EssentialService +from ctrack.core.utils import fnames pytestmark = pytest.mark.django_db @@ -24,6 +30,22 @@ def test_new_address(addr): assert addr.organisation.name -def test_essential_service(): - es = EssentialService() - assert es +def test_essential_service(org): + q1 = Grading.objects.create(descriptor="Q1", description="baws", type="QUALITY") + c1 = Grading.objects.create( + descriptor="C1", description="baws_c", type="CONFIDENCE" + ) + caf = CAF.objects.create( + quality_grading=q1, + confidence_grading=c1, + triage_review_date=None, + triage_review_inspector=None, + ) + ass = ApplicableSystemFactory.create( + name=random.choice(fnames), organisation=org, caf=caf, + ) + es = EssentialService.objects.create( + name="Test ES", description="Test ES Description", organisation=org + ) + es.systems.add(ass) + assert es.systems.first().organisation.name == org.name @@ -1,6 +1,7 @@ [pytest] addopts = - --ds=config.settings.test --disable-warnings --nomigrations --reuse-db +# --ds=config.settings.test --disable-warnings --nomigrations --reuse-db + --ds=config.settings.test --disable-warnings --nomigrations filterwarnings = ignore::DeprecationWarning python_files = tests.py test_*.py |