| @@ 357-367 (lines=11) @@ | ||
| 354 | evc = EVC(**attributes) |
|
| 355 | self.assertFalse(evc.should_deploy(attributes['primary_links'])) |
|
| 356 | ||
| 357 | @patch('napps.kytos.mef_eline.models.requests') |
|
| 358 | def test_send_flow_mods(self, requests_mock): |
|
| 359 | """Test if you are sending flow_mods.""" |
|
| 360 | flow_mods = {"id": 20} |
|
| 361 | switch = Mock(spec=Switch, id=1) |
|
| 362 | EVC.send_flow_mods(switch, flow_mods) |
|
| 363 | expected_endpoint = f"{MANAGER_URL}/flows/{switch.id}" |
|
| 364 | expected_data = {"flows": flow_mods} |
|
| 365 | self.assertEqual(requests_mock.post.call_count, 1) |
|
| 366 | requests_mock.post.assert_called_once_with(expected_endpoint, |
|
| 367 | json=expected_data) |
|
| 368 | ||
| 369 | def test_prepare_flow_mod(self): |
|
| 370 | """Test prepare flow_mod method.""" |
|
| @@ 86-96 (lines=11) @@ | ||
| 83 | evc = EVC(**attributes) |
|
| 84 | self.assertFalse(evc.should_deploy(attributes['primary_links'])) |
|
| 85 | ||
| 86 | @patch('napps.kytos.mef_eline.models.requests') |
|
| 87 | def test_send_flow_mods(self, requests_mock): |
|
| 88 | """Test if you are sending flow_mods.""" |
|
| 89 | flow_mods = {"id": 20} |
|
| 90 | switch = Mock(spec=Switch, id=1) |
|
| 91 | EVC.send_flow_mods(switch, flow_mods) |
|
| 92 | expected_endpoint = f"{MANAGER_URL}/flows/{switch.id}" |
|
| 93 | expected_data = {"flows": flow_mods} |
|
| 94 | self.assertEqual(requests_mock.post.call_count, 1) |
|
| 95 | requests_mock.post.assert_called_once_with(expected_endpoint, |
|
| 96 | json=expected_data) |
|
| 97 | ||
| 98 | def test_prepare_flow_mod(self): |
|
| 99 | """Test prepare flow_mod method.""" |
|