diff --git a/concordia/tests/test_views.py b/concordia/tests/test_views.py index e5998e7cb..9e4bb5508 100644 --- a/concordia/tests/test_views.py +++ b/concordia/tests/test_views.py @@ -40,6 +40,7 @@ create_asset, create_campaign, create_card_family, + create_guide, create_item, create_project, create_topic, @@ -378,6 +379,8 @@ def test_asset_detail_view(self): asset.item.project.campaign.card_family = create_card_family() asset.item.project.campaign.save() + title = "Transcription: Basic Rules" + create_guide(title=title) response = self.client.get( reverse( @@ -390,9 +393,10 @@ def test_asset_detail_view(self): }, ) ) - self.assertEqual(response.status_code, 200) self.assertIn("cards", response.context) + self.assertIn("guides", response.context) + self.assertEqual(title, response.context["guides"][0]["title"]) @patch.object(Asset, "get_ocr_transcript") def test_generate_ocr_transcription(self, mock): diff --git a/concordia/tests/utils.py b/concordia/tests/utils.py index d87117c9d..b38d2f6b8 100644 --- a/concordia/tests/utils.py +++ b/concordia/tests/utils.py @@ -9,6 +9,7 @@ Campaign, Card, CardFamily, + Guide, Item, MediaType, Project, @@ -232,6 +233,13 @@ def create_card_family(*, do_save=True, **kwargs): return card_family +def create_guide(*, do_save=True, **kwargs): + guide = Guide(**kwargs) + if do_save: + guide.save() + return guide + + class JSONAssertMixin(object): def assertValidJSON(self, response, expected_status=200): """