aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_bot_snake.py
diff options
context:
space:
mode:
authorGravatar Leon Sandøy <[email protected]>2018-07-29 09:53:01 +0000
committerGravatar Leon Sandøy <[email protected]>2018-07-29 09:53:01 +0000
commitc3cbadf64c1d568e957274e331241691de356f7f (patch)
tree3c41f029f67adda015590ed6553b1dbf30c2aabf /tests/test_api_bot_snake.py
parentFix typo in infractions table definition (diff)
parentAddressing gdude comments (diff)
Merge branch 'clean_command' into 'master'
Clean command API and frontend See merge request python-discord/projects/site!26
Diffstat (limited to 'tests/test_api_bot_snake.py')
-rw-r--r--tests/test_api_bot_snake.py62
1 files changed, 42 insertions, 20 deletions
diff --git a/tests/test_api_bot_snake.py b/tests/test_api_bot_snake.py
index b5aa3bab..fcc18409 100644
--- a/tests/test_api_bot_snake.py
+++ b/tests/test_api_bot_snake.py
@@ -1,42 +1,64 @@
-import os
+"""Tests the `/api/bot/snake_` endpoints."""
+
from tests import SiteTest, app
-class ApiBotSnakeEndpoints(SiteTest):
- """
- Tests the following endpoints:
- - snake_movies
- - snake_quiz
- - snake_names
- - snake_idioms
- - snake_facts
- """
+
+class TestSnakeFactsAPI(SiteTest):
+ """GET method - get snake fact"""
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'])
+ 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)
+
+class TestSnakeIdiomAPI(SiteTest):
+ """GET method - get snake idiom"""
+
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'])
+ 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)
+
+class TestSnakeQuizAPI(SiteTest):
+ """GET method - get snake quiz"""
+
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'])
+ 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)
+
+class TestSnakeNameAPI(SiteTest):
+ """GET method - get a single snake name, or all of them."""
+
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'])
+ 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'])
+ 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)