Skip to content

Commit 36d90a2

Browse files
committed
Fix feature video
1 parent 5869e12 commit 36d90a2

2 files changed

Lines changed: 28 additions & 2 deletions

File tree

thothlibrary/tests/test_queries.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"""
2+
Tests for generated GraphQL query field selections.
3+
"""
4+
import unittest
5+
from importlib import import_module
6+
7+
8+
queries = import_module("thothlibrary.thoth-1_0_0.queries")
9+
10+
11+
class QueryFieldTests(unittest.TestCase):
12+
def test_work_full_fields_use_featured_video(self):
13+
fields = " ".join(queries.WORK_FULL_FIELDS)
14+
15+
self.assertIn("featuredVideo { workFeaturedVideoId", fields)
16+
self.assertNotIn("workFeaturedVideos {", fields)
17+
18+
def test_work_list_fields_use_featured_video(self):
19+
fields = " ".join(queries.WORK_LIST_FIELDS)
20+
21+
self.assertIn("featuredVideo { workFeaturedVideoId", fields)
22+
self.assertNotIn("workFeaturedVideos {", fields)
23+
24+
25+
if __name__ == "__main__":
26+
unittest.main()

thothlibrary/thoth-1_0_0/queries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@
129129
"text(markupFormat: JATS_XML) reviewOrdinal __typename }"
130130
),
131131
(
132-
"workFeaturedVideos { workFeaturedVideoId title url width height "
132+
"featuredVideo { workFeaturedVideoId title url width height "
133133
"file { fileId fileType cdnUrl __typename } __typename }"
134134
),
135135
(
@@ -166,7 +166,7 @@
166166
"awards { awardId awardOrdinal __typename }",
167167
"endorsements { endorsementId endorsementOrdinal __typename }",
168168
"bookReviews { bookReviewId reviewOrdinal __typename }",
169-
"workFeaturedVideos { workFeaturedVideoId title __typename }",
169+
"featuredVideo { workFeaturedVideoId title __typename }",
170170
"imprint { imprintId imprintName " + PUBLISHER_LINK + " __typename }",
171171
"__typename",
172172
]

0 commit comments

Comments
 (0)