| @@ 369-381 (lines=13) @@ | ||
| 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.""" |
|
| 371 | interface_a = Interface('eth0', 1, Mock(spec=Switch)) |
|
| 372 | interface_z = Interface('eth1', 3, Mock(spec=Switch)) |
|
| 373 | flow_mod = EVC.prepare_flow_mod(interface_a, interface_z) |
|
| 374 | expected_flow_mod = { |
|
| 375 | 'match': {'in_port': interface_a.port_number}, |
|
| 376 | 'actions': [ |
|
| 377 | {'action_type': 'output', |
|
| 378 | 'port': interface_z.port_number} |
|
| 379 | ] |
|
| 380 | } |
|
| 381 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 382 | ||
| 383 | def test_prepare_pop_flow(self): |
|
| 384 | """Test prepare pop flow method.""" |
|
| @@ 98-110 (lines=13) @@ | ||
| 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.""" |
|
| 100 | interface_a = Interface('eth0', 1, Mock(spec=Switch)) |
|
| 101 | interface_z = Interface('eth1', 3, Mock(spec=Switch)) |
|
| 102 | flow_mod = EVC.prepare_flow_mod(interface_a, interface_z) |
|
| 103 | expected_flow_mod = { |
|
| 104 | 'match': {'in_port': interface_a.port_number}, |
|
| 105 | 'actions': [ |
|
| 106 | {'action_type': 'output', |
|
| 107 | 'port': interface_z.port_number} |
|
| 108 | ] |
|
| 109 | } |
|
| 110 | self.assertEqual(expected_flow_mod, flow_mod) |
|
| 111 | ||
| 112 | def test_prepare_pop_flow(self): |
|
| 113 | """Test prepare pop flow method.""" |
|