diff options
| author | 2018-09-01 23:03:58 +0200 | |
|---|---|---|
| committer | 2018-09-01 23:03:58 +0200 | |
| commit | a7d53a349a067c23b4963122ac62b96624c91eec (patch) | |
| tree | f64a575019b752b6cc8c5388122fae6913425c30 /api/tests | |
| parent | Add support for deleting off-topic-channel names. (diff) | |
Add tests for untested branches.
Diffstat (limited to '')
| -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 +        }) | 
