aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_bot_snake.py
diff options
context:
space:
mode:
authorGravatar Christopher Baklid <[email protected]>2018-05-20 21:11:18 +0200
committerGravatar GitHub <[email protected]>2018-05-20 21:11:18 +0200
commit687fedfffa402e049c59668f2a6248ad2ba17910 (patch)
tree834e909781213650b40508398ed5a9bef10686c5 /tests/test_api_bot_snake.py
parentremove set -e (diff)
Tests directory (#73)
moves all tests into a testing directory and splits the tests into separate files
Diffstat (limited to 'tests/test_api_bot_snake.py')
-rw-r--r--tests/test_api_bot_snake.py42
1 files changed, 42 insertions, 0 deletions
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)