Completed
Branch master (71691c)
by Antoine
34s
created

TestSwagger   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 21
rs 10
wmc 5

3 Methods

Rating   Name   Duplication   Size   Complexity  
A test_get_spec() 0 7 2
A test_swagger_is_not_empty() 0 8 2
A setUpClass() 0 3 1
1
import unittest
2
import json
3
import warnings
4
5
from server import server
6
7
8
class TestSwagger(unittest.TestCase):
9
    @classmethod
10
    def setUpClass(cls):
11
        cls.client = server.test_client()
12
13
    def test_get_spec(self):
14
        """ The GET on /spec should return a 200 """
15
16
        with warnings.catch_warnings():
17
            warnings.filterwarnings("ignore", message="unclosed file")
18
            response = self.client.get('/application/spec')
19
        self.assertEqual(response.status_code, 200)
20
21
    def test_swagger_is_not_empty(self):
22
        """ The GET on /spec should return an object with a non-empty paths property """
23
24
        with warnings.catch_warnings():
25
            warnings.filterwarnings("ignore", message="unclosed file")
26
            response = self.client.get('/application/spec')
27
        response_json = json.loads(response.data.decode('utf-8'))
28
        self.assertTrue(response_json['paths'])
29