From 687fedfffa402e049c59668f2a6248ad2ba17910 Mon Sep 17 00:00:00 2001 From: Christopher Baklid Date: Sun, 20 May 2018 21:11:18 +0200 Subject: Tests directory (#73) moves all tests into a testing directory and splits the tests into separate files --- tests/test_api_bot_snake.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100644 tests/test_api_bot_snake.py (limited to 'tests/test_api_bot_snake.py') diff --git a/tests/test_api_bot_snake.py b/tests/test_api_bot_snake.py new file mode 100644 index 00000000..b5aa3bab --- /dev/null +++ b/tests/test_api_bot_snake.py @@ -0,0 +1,42 @@ +import os +from tests import SiteTest, app + +class ApiBotSnakeEndpoints(SiteTest): + """ + Tests the following endpoints: + - snake_movies + - snake_quiz + - snake_names + - snake_idioms + - snake_facts + """ + + def test_snake_facts(self): + # GET method - get snake fact + response = self.client.get('/bot/snake_facts', app.config['API_SUBDOMAIN'], headers=app.config['TEST_HEADER']) + self.assertEqual(response.status_code, 200) + self.assertEqual(type(response.json), str) + + def test_snake_idiom(self): + # GET method - get snake idiom + response = self.client.get('/bot/snake_idioms', app.config['API_SUBDOMAIN'], headers=app.config['TEST_HEADER']) + self.assertEqual(response.status_code, 200) + self.assertEqual(type(response.json), str) + + def test_snake_quiz(self): + # GET method - get snake quiz + response = self.client.get('/bot/snake_quiz', app.config['API_SUBDOMAIN'], headers=app.config['TEST_HEADER']) + self.assertEqual(response.status_code, 200) + self.assertEqual(type(response.json), dict) + + def test_snake_names(self): + # GET method - get snake name + response = self.client.get('/bot/snake_names', app.config['API_SUBDOMAIN'], headers=app.config['TEST_HEADER']) + self.assertEqual(response.status_code, 200) + self.assertEqual(type(response.json), dict) + + def test_snake_names_all(self): + # GET method - get all snake names + response = self.client.get('/bot/snake_names?get_all=True', app.config['API_SUBDOMAIN'], headers=app.config['TEST_HEADER']) + self.assertEqual(response.status_code, 200) + self.assertEqual(type(response.json), list) -- cgit v1.2.3