|
@@ 107-122 (lines=16) @@
|
| 104 |
|
evc.update(**update_dict) |
| 105 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 106 |
|
|
| 107 |
|
def test_update_uni_z(self): |
| 108 |
|
"""Test if raises and error when trying to update the uni_z.""" |
| 109 |
|
attributes = { |
| 110 |
|
"controller": get_controller_mock(), |
| 111 |
|
"name": "circuit_name", |
| 112 |
|
"uni_a": get_uni_mocked(is_valid=True), |
| 113 |
|
"uni_z": get_uni_mocked(is_valid=True) |
| 114 |
|
} |
| 115 |
|
update_dict = { |
| 116 |
|
"uni_z": get_uni_mocked(is_valid=True) |
| 117 |
|
} |
| 118 |
|
error_message = "uni_z can't be be updated." |
| 119 |
|
with self.assertRaises(ValueError) as handle_error: |
| 120 |
|
evc = EVC(**attributes) |
| 121 |
|
evc.update(**update_dict) |
| 122 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 123 |
|
|
| 124 |
|
@patch('napps.kytos.mef_eline.models.EVC.sync') |
| 125 |
|
def test_update_disable(self, _sync_mock): |
|
@@ 90-105 (lines=16) @@
|
| 87 |
|
evc.update(**update_dict) |
| 88 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 89 |
|
|
| 90 |
|
def test_update_uni_a(self): |
| 91 |
|
"""Test if raises and error when trying to update the uni_a.""" |
| 92 |
|
attributes = { |
| 93 |
|
"controller": get_controller_mock(), |
| 94 |
|
"name": "circuit_name", |
| 95 |
|
"uni_a": get_uni_mocked(is_valid=True), |
| 96 |
|
"uni_z": get_uni_mocked(is_valid=True) |
| 97 |
|
} |
| 98 |
|
update_dict = { |
| 99 |
|
"uni_a": get_uni_mocked(is_valid=True) |
| 100 |
|
} |
| 101 |
|
error_message = "uni_a can't be be updated." |
| 102 |
|
with self.assertRaises(ValueError) as handle_error: |
| 103 |
|
evc = EVC(**attributes) |
| 104 |
|
evc.update(**update_dict) |
| 105 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 106 |
|
|
| 107 |
|
def test_update_uni_z(self): |
| 108 |
|
"""Test if raises and error when trying to update the uni_z.""" |
|
@@ 73-88 (lines=16) @@
|
| 70 |
|
EVC(**attributes) |
| 71 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 72 |
|
|
| 73 |
|
def test_update_name(self): |
| 74 |
|
"""Test if raises and error when trying to update the name.""" |
| 75 |
|
attributes = { |
| 76 |
|
"controller": get_controller_mock(), |
| 77 |
|
"name": "circuit_name", |
| 78 |
|
"uni_a": get_uni_mocked(is_valid=True), |
| 79 |
|
"uni_z": get_uni_mocked(is_valid=True) |
| 80 |
|
} |
| 81 |
|
update_dict = { |
| 82 |
|
"name": "circuit_name_2" |
| 83 |
|
} |
| 84 |
|
error_message = "name can't be be updated." |
| 85 |
|
with self.assertRaises(ValueError) as handle_error: |
| 86 |
|
evc = EVC(**attributes) |
| 87 |
|
evc.update(**update_dict) |
| 88 |
|
self.assertEqual(str(handle_error.exception), error_message) |
| 89 |
|
|
| 90 |
|
def test_update_uni_a(self): |
| 91 |
|
"""Test if raises and error when trying to update the uni_a.""" |