|
@@ 199-212 (lines=14) @@
|
| 196 |
|
with self.assertRaises(KytosException): |
| 197 |
|
self.napps_api.install_napp(mgr) |
| 198 |
|
|
| 199 |
|
@patch('kytos.utils.napps.NAppsManager') |
| 200 |
|
def test_install_napp_error_400(self, mgr): |
| 201 |
|
"""Test install_napp method.""" |
| 202 |
|
mgr = MagicMock() |
| 203 |
|
|
| 204 |
|
url = 'napps.kytos.io' |
| 205 |
|
msg = 'The NApp were not found at server.' |
| 206 |
|
code = 400 |
| 207 |
|
hdrs = 'The HTTP response headers' |
| 208 |
|
filep = None |
| 209 |
|
mgr.remote_install.side_effect = HTTPError(url, code, msg, hdrs, filep) |
| 210 |
|
|
| 211 |
|
with self.assertRaises(KytosException): |
| 212 |
|
self.napps_api.install_napp(mgr) |
| 213 |
|
|
| 214 |
|
@patch('kytos.cli.commands.napps.api.NAppsManager.search') |
| 215 |
|
@patch('kytos.cli.commands.napps.api.NAppsAPI._print_napps') |
|
@@ 185-197 (lines=13) @@
|
| 182 |
|
|
| 183 |
|
mgr.remote_install.assert_called() |
| 184 |
|
|
| 185 |
|
@patch('kytos.utils.napps.NAppsManager') |
| 186 |
|
def test_install_napp_error_404(self, mgr): |
| 187 |
|
"""Test install_napp method.""" |
| 188 |
|
mgr = MagicMock() |
| 189 |
|
|
| 190 |
|
url = 'napps.kytos.io' |
| 191 |
|
msg = 'The NApp were not found at server.' |
| 192 |
|
code = 404 |
| 193 |
|
hdrs = 'The HTTP response headers' |
| 194 |
|
filep = None |
| 195 |
|
mgr.remote_install.side_effect = HTTPError(url, code, msg, hdrs, filep) |
| 196 |
|
with self.assertRaises(KytosException): |
| 197 |
|
self.napps_api.install_napp(mgr) |
| 198 |
|
|
| 199 |
|
@patch('kytos.utils.napps.NAppsManager') |
| 200 |
|
def test_install_napp_error_400(self, mgr): |