Skip to content

Commit 04638d1

Browse files
committed
Add simple locale parm test
1 parent 8cd8914 commit 04638d1

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

tests/test_endpoints/test_relations.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ def test_relations_endpoint_parms(self):
4444
)
4545
self.assertEqual(result.status_code, 422)
4646
# check depth parm working as expected
47+
result = self.client.get(
48+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L?depth"
49+
)
50+
self.assertEqual(result.status_code, 422)
4751
result = self.client.get(
4852
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L?depth=5"
4953
)
@@ -54,6 +58,15 @@ def test_relations_endpoint_parms(self):
5458
self.assertEqual(
5559
result.json["relationship_string"], "second great stepgrandaunt"
5660
)
61+
# check locale parm working
62+
result = self.client.get(
63+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L?locale"
64+
)
65+
self.assertEqual(result.status_code, 422)
66+
result = self.client.get(
67+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L?locale=1"
68+
)
69+
self.assertEqual(result.status_code, 200)
5770

5871

5972
class TestRelations(unittest.TestCase):
@@ -102,6 +115,10 @@ def test_relations_all_endpoint_parms(self):
102115
)
103116
self.assertEqual(result.status_code, 422)
104117
# check depth parm working as expected
118+
result = self.client.get(
119+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L/all?depth"
120+
)
121+
self.assertEqual(result.status_code, 422)
105122
result = self.client.get(
106123
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L/all?depth=5"
107124
)
@@ -112,3 +129,12 @@ def test_relations_all_endpoint_parms(self):
112129
self.assertEqual(
113130
result.json[0]["relationship_string"], "second great stepgrandaunt"
114131
)
132+
# check locale parm working
133+
result = self.client.get(
134+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L/all?locale"
135+
)
136+
self.assertEqual(result.status_code, 422)
137+
result = self.client.get(
138+
"/api/relations/9BXKQC1PVLPYFMD6IX/ORFKQC4KLWEGTGR19L/all?locale=1"
139+
)
140+
self.assertEqual(result.status_code, 200)

0 commit comments

Comments
 (0)