aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test_api_bot_snake.py
blob: fcc1840932d14855ac81775c732f4766b613aa60 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
"""Tests the `/api/bot/snake_` endpoints."""

from tests import SiteTest, app


class TestSnakeFactsAPI(SiteTest):
    """GET method - get snake fact"""

    def test_snake_facts(self):
        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):
        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):
        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):
        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):
        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)