diff options
-rw-r--r-- | api/tests/test_off_topic_channel_names.py | 9 | ||||
-rw-r--r-- | api/tests/test_snake_names.py | 12 |
2 files changed, 19 insertions, 2 deletions
diff --git a/api/tests/test_off_topic_channel_names.py b/api/tests/test_off_topic_channel_names.py index 1f6e4ee3..1b222dca 100644 --- a/api/tests/test_off_topic_channel_names.py +++ b/api/tests/test_off_topic_channel_names.py @@ -46,6 +46,15 @@ class EmptyDatabaseTests(APISubdomainTestCase): 'random_items': ["Must be a valid integer."] }) + def test_returns_400_for_negative_random_items_param(self): + url = reverse('bot:offtopicchannelname-list', host='api') + response = self.client.get(f'{url}?random_items=-5') + + self.assertEqual(response.status_code, 400) + self.assertEqual(response.json(), { + 'random_items': ["Must be a positive integer."] + }) + class ListTests(APISubdomainTestCase): @classmethod diff --git a/api/tests/test_snake_names.py b/api/tests/test_snake_names.py index cc14abb1..6a669557 100644 --- a/api/tests/test_snake_names.py +++ b/api/tests/test_snake_names.py @@ -53,8 +53,16 @@ class SnakeNameListTests(APISubdomainTestCase): response.json(), [ { - 'name': 'Python', - 'scientific': 'Totally.' + 'name': self.snake_python.name, + 'scientific': self.snake_python.scientific } ] ) + + def test_endpoint_returns_single_snake_without_get_all_param(self): + url = reverse('bot:snakename-list', host='api') + response = self.client.get(url) + self.assertEqual(response.json(), { + 'name': self.snake_python.name, + 'scientific': self.snake_python.scientific + }) |