Skip to content

Commit

Permalink
added test for pull endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew-fenton committed Nov 30, 2024
1 parent 1619b42 commit 07af7fe
Showing 1 changed file with 29 additions and 1 deletion.
30 changes: 29 additions & 1 deletion core/i18nilize/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -1010,4 +1010,32 @@ def test_bulk_translations(self):
# validate get requests
response = self.client.get(reverse('translation'), query_params=query_params_get[i], headers=headers)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
self.assertEqual(response.data['error'], 'Translation not found for given language and word!')
self.assertEqual(response.data['error'], 'Translation not found for given language and word!')

class PullTranslations(APITestCase):

def setUp(self):
token = Token.objects.create()
self.TEST_TOKEN = str(token.value)

def test_pulling_no_assigned_translations(self):
pass

def test_pulling_multiple_assigned_translations(self):
headers = {
'Token': self.TEST_TOKEN
}
query_params = {
'language': 'spanish',
'hello': 'hola'
}
expected_response = {
'spanish': {
'hello': 'hola'
}
}
self.client.post(reverse('translation'), query_params=query_params, headers=headers, format='json')

response = self.client.get(reverse('pull-translations'), headers=headers, format='json')
response_data = response.json()
self.assertEqual(response_data, expected_response)

0 comments on commit 07af7fe

Please sign in to comment.