Skip to content

Commit e8de603

Browse files
committed
tested for succesfull response
1 parent 043bd76 commit e8de603

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

web/tests/test_views.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,23 @@ def test_api_not_found(self):
250250

251251
self.assertEqual(response.status_code, HTTPStatus.NOT_FOUND)
252252

253+
def test_single_concept_view_valid_language_version(self):
254+
"""
255+
Test if the API response contains 'meta' and 'concepts' keys. And doesnt return error.
256+
"""
257+
url = '/api/data_types/javascript/ECMAScript%202009/'
258+
259+
# Send GET request to the URL
260+
response = self.client.get(url)
261+
262+
# Check the response status
263+
self.assertEqual(response.status_code, HTTPStatus.OK)
264+
265+
# Parse the response JSON
266+
response_data = response.json()
267+
268+
# Assert that 'meta' and 'concepts' keys exist
269+
self.assertIn('meta', response_data)
270+
self.assertIn('concepts', response_data)
271+
253272

web/views.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ def api_reference(request, structure_key, lang, version):
437437
if response is False:
438438
return HttpResponseNotFound()
439439

440+
print(response)
441+
print("=======================")
442+
440443
return HttpResponse(response, content_type="application/json")
441444

442445
def api_compare(request, structure_key, lang1, version1, lang2, version2):

0 commit comments

Comments
 (0)