| @@ 645-664 (lines=20) @@ | ||
| 642 | self.assertEqual(log_mock.info.call_count, 0) |
|
| 643 | self.assertFalse(deployed) |
|
| 644 | ||
| 645 | def test_is_using_backup_path(self): |
|
| 646 | """Test test is using backup path.""" |
|
| 647 | backup_path = [ |
|
| 648 | get_link_mocked(endpoint_a_port=9, endpoint_b_port=10, |
|
| 649 | metadata={"s_vlan": 5}), |
|
| 650 | get_link_mocked(endpoint_a_port=11, endpoint_b_port=12, |
|
| 651 | metadata={"s_vlan": 6}) |
|
| 652 | ] |
|
| 653 | ||
| 654 | attributes = { |
|
| 655 | "name": "circuit_name", |
|
| 656 | "uni_a": get_uni_mocked(is_valid=True), |
|
| 657 | "uni_z": get_uni_mocked(is_valid=True), |
|
| 658 | "backup_path": backup_path |
|
| 659 | } |
|
| 660 | ||
| 661 | evc = EVC(**attributes) |
|
| 662 | self.assertFalse(evc.is_using_backup_path()) |
|
| 663 | evc.current_path = evc.backup_path |
|
| 664 | self.assertTrue(evc.is_using_backup_path()) |
|
| 665 | ||
| 666 | def test_is_using_primary_path(self): |
|
| 667 | """Test test is using primary path.""" |
|
| @@ 19-38 (lines=20) @@ | ||
| 16 | class TestLinkProtection(TestCase): # pylint: disable=too-many-public-methods |
|
| 17 | """Tests to validate LinkProtection class.""" |
|
| 18 | ||
| 19 | def test_is_using_backup_path(self): |
|
| 20 | """Test test is using backup path.""" |
|
| 21 | backup_path = [ |
|
| 22 | get_link_mocked(endpoint_a_port=9, endpoint_b_port=10, |
|
| 23 | metadata={"s_vlan": 5}), |
|
| 24 | get_link_mocked(endpoint_a_port=11, endpoint_b_port=12, |
|
| 25 | metadata={"s_vlan": 6}) |
|
| 26 | ] |
|
| 27 | ||
| 28 | attributes = { |
|
| 29 | "name": "circuit_name", |
|
| 30 | "uni_a": get_uni_mocked(is_valid=True), |
|
| 31 | "uni_z": get_uni_mocked(is_valid=True), |
|
| 32 | "backup_path": backup_path |
|
| 33 | } |
|
| 34 | ||
| 35 | evc = EVC(**attributes) |
|
| 36 | self.assertFalse(evc.is_using_backup_path()) |
|
| 37 | evc.current_path = evc.backup_path |
|
| 38 | self.assertTrue(evc.is_using_backup_path()) |
|
| 39 | ||
| 40 | def test_is_using_primary_path(self): |
|
| 41 | """Test test is using primary path.""" |
|