Test Failed
Pull Request — master (#36)
by Jose
02:22
created

tests.test_port   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 20
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestPort.test_non_existent_port() 0 7 2
1
"""Test port statistics."""
2
from unittest import TestCase
3
from unittest.mock import patch
4
5
from flask import Response
6
7
from stats_api import PortStatsAPI
8
9
10
class TestPort(TestCase):
11
    """Test switch ports."""
12
13
    def test_non_existent_port(self):
14
        """Should return 404."""
15
        api = PortStatsAPI('non-existent-switch', 123)
16
        with patch('stats_api.request'):
17
            response = api.get_stats()
18
            self.assertIsInstance(response, Response,
19
                                  'Should be a flask.Response object')
20