Total Complexity | 2 |
Total Lines | 20 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |