From bc1403eb0c3733d0f61abd0737babf2e1ad53801 Mon Sep 17 00:00:00 2001 From: TNA-Allan Date: Wed, 11 Dec 2024 12:10:28 +0000 Subject: [PATCH] FIND-81:update tests --- test/ciim/factories.py | 3 +-- test/records/test_views.py | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/test/ciim/factories.py b/test/ciim/factories.py index 8bcc393..6230314 100644 --- a/test/ciim/factories.py +++ b/test/ciim/factories.py @@ -1,7 +1,6 @@ def create_record( template_details=None, iaid="C0000000", - source="CAT", ): """ Return a sample response for a record. @@ -9,7 +8,7 @@ def create_record( otherwise creates a record with iaid """ if not template_details: - template_details = {"iaid": iaid, "source": source} + template_details = {"iaid": iaid} # a typical record record = {"@template": {"details": template_details}} diff --git a/test/records/test_views.py b/test/records/test_views.py index 0c064f2..3f5da37 100644 --- a/test/records/test_views.py +++ b/test/records/test_views.py @@ -1,6 +1,7 @@ from test.ciim.factories import create_record, create_response import responses +from app.records.models import Record from django.conf import settings from django.test import TestCase @@ -36,7 +37,9 @@ def test_record_rendered_for_single_result(self): f"{settings.CLIENT_BASE_URL}/get", json=create_response( records=[ - create_record(iaid="C123456"), + create_record( + template_details={"iaid": "C123456", "source": "CAT"} + ), ] ), ) @@ -56,3 +59,7 @@ def test_record_rendered_for_single_result(self): self.assertEqual( response.context_data.get("page_title"), "Catalogue ID: C123456" ) + self.assertIsInstance(response.context_data.get("record"), Record) + + # record attribute + self.assertEqual(response.context_data.get("record").source, "CAT")