Passed
Pull Request — master (#371)
by
unknown
03:30
created

TestEVC.test_update_disable()   A

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 7
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 13
nop 2
dl 0
loc 15
ccs 7
cts 7
cp 1
crap 1
rs 9.75
c 0
b 0
f 0
1
"""Module to test the EVCBase class."""
2 1
import sys
3 1
from unittest.mock import MagicMock, patch, call
4 1
from napps.kytos.mef_eline.models import Path
5 1
import pytest
6
# pylint: disable=wrong-import-position
7 1
sys.path.insert(0, "/var/lib/kytos/napps/..")
8
# pylint: enable=wrong-import-position, disable=ungrouped-imports
9 1
from napps.kytos.mef_eline.models import EVC  # NOQA  pycodestyle
10 1
from napps.kytos.mef_eline.scheduler import (
11
    CircuitSchedule,
12
)  # NOQA  pycodestyle
13 1
from napps.kytos.mef_eline.tests.helpers import (
14
    get_uni_mocked,
15
    get_controller_mock,
16
)  # NOQA  pycodestyle
17
18
19 1
class TestEVC():  # pylint: disable=too-many-public-methods, no-member
20
    """Tests to verify EVC class."""
21
22 1
    def test_attributes_empty(self):
23
        """Test if the EVC raises an error with name is required."""
24 1
        attributes = {"controller": get_controller_mock()}
25 1
        error_message = "name is required."
26 1
        with pytest.raises(ValueError) as handle_error:
27 1
            EVC(**attributes)
28 1
        assert error_message in str(handle_error)
29
30 1
    def test_expected_requiring_redeploy_attributes(self) -> None:
31
        """Test expected attributes_requiring_redeploy."""
32 1
        expected = [
33
            "primary_path",
34
            "backup_path",
35
            "dynamic_backup_path",
36
            "queue_id",
37
            "sb_priority",
38
            "primary_constraints",
39
            "secondary_constraints",
40
            "uni_a",
41
            "uni_z",
42
        ]
43 1
        assert EVC.attributes_requiring_redeploy == expected
44
45 1
    def test_expeted_read_only_attributes(self) -> None:
46
        """Test expected read_only_attributes."""
47 1
        expected = [
48
            "creation_time",
49
            "active",
50
            "current_path",
51
            "failover_path",
52
            "_id",
53
            "archived",
54
        ]
55 1
        assert EVC.read_only_attributes == expected
56
57 1
    def test_without_uni_a(self):
58
        """Test if the EVC raises and error with UNI A is required."""
59 1
        attributes = {
60
            "controller": get_controller_mock(),
61
            "name": "circuit_name",
62
        }
63 1
        error_message = "uni_a is required."
64 1
        with pytest.raises(ValueError) as handle_error:
65 1
            EVC(**attributes)
66 1
        assert error_message in str(handle_error)
67
68 1
    def test_without_uni_z(self):
69
        """Test if the EVC raises and error with UNI Z is required."""
70 1
        attributes = {
71
            "controller": get_controller_mock(),
72
            "name": "circuit_name",
73
            "uni_a": get_uni_mocked(is_valid=True),
74
        }
75 1
        error_message = "uni_z is required."
76 1
        with pytest.raises(ValueError) as handle_error:
77 1
            EVC(**attributes)
78 1
        assert error_message in str(handle_error)
79
80 1
    @pytest.mark.parametrize(
81
        "name,value",
82
        [
83
            ("archived", True),
84
            ("_id", True),
85
            ("active", True),
86
            ("current_path", []),
87
            ("creation_time", "date"),
88
        ]
89
    )
90 1
    def test_update_read_only(self, name, value):
91
        """Test if raises an error when trying to update read only attr."""
92 1
        attributes = {
93
            "controller": get_controller_mock(),
94
            "name": "circuit_name",
95
            "dynamic_backup_path": True,
96
            "uni_a": get_uni_mocked(is_valid=True),
97
            "uni_z": get_uni_mocked(is_valid=True),
98
        }
99
100 1
        update_dict = {name: value}
101 1
        error_message = f"{name} can't be updated."
102 1
        with pytest.raises(ValueError) as handle_error:
103 1
            evc = EVC(**attributes)
104 1
            evc.update(**update_dict)
105 1
        assert error_message in str(handle_error)
106
107 1
    def test_update_invalid(self):
108
        """Test updating with an invalid attr"""
109 1
        attributes = {
110
            "controller": get_controller_mock(),
111
            "name": "circuit_name",
112
            "dynamic_backup_path": True,
113
            "uni_a": get_uni_mocked(is_valid=True),
114
            "uni_z": get_uni_mocked(is_valid=True),
115
        }
116 1
        evc = EVC(**attributes)
117 1
        with pytest.raises(ValueError) as handle_error:
118 1
            evc.update(xyz="abc")
119 1
        assert (
120
            'The attribute "xyz" is invalid.'
121
            in str(handle_error)
122
        )
123
124 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
125 1
    def test_update_disable(self, _sync_mock):
126
        """Test if evc is disabled."""
127 1
        attributes = {
128
            "controller": get_controller_mock(),
129
            "name": "circuit_name",
130
            "dynamic_backup_path": True,
131
            "enable": True,
132
            "uni_a": get_uni_mocked(is_valid=True),
133
            "uni_z": get_uni_mocked(is_valid=True),
134
        }
135 1
        update_dict = {"enable": False}
136 1
        evc = EVC(**attributes)
137 1
        evc.update(**update_dict)
138 1
        assert evc.is_enabled() is False
139
140 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
141 1
    def test_update_empty_primary_path(self, _sync_mock):
142
        """Test if an empty primary path can be set."""
143 1
        initial_primary_path = Path([MagicMock(id=1), MagicMock(id=2)])
144 1
        attributes = {
145
            "controller": get_controller_mock(),
146
            "name": "circuit_name",
147
            "dynamic_backup_path": True,
148
            "primary_path": initial_primary_path,
149
            "enable": True,
150
            "uni_a": get_uni_mocked(is_valid=True),
151
            "uni_z": get_uni_mocked(is_valid=True),
152
        }
153 1
        update_dict = {"primary_path": Path([])}
154 1
        evc = EVC(**attributes)
155 1
        assert evc.primary_path == initial_primary_path
156 1
        evc.update(**update_dict)
157 1
        assert len(evc.primary_path) == 0
158
159 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
160 1
    def test_update_empty_path_non_dynamic_backup(self, _sync_mock):
161
        """Test if an empty primary path can't be set if dynamic."""
162 1
        initial_primary_path = Path([MagicMock(id=1), MagicMock(id=2)])
163 1
        attributes = {
164
            "controller": get_controller_mock(),
165
            "name": "circuit_name",
166
            "dynamic_backup_path": False,
167
            "primary_path": initial_primary_path,
168
            "enable": True,
169
            "uni_a": get_uni_mocked(is_valid=True),
170
            "uni_z": get_uni_mocked(is_valid=True),
171
        }
172 1
        update_dict = {"primary_path": Path([])}
173 1
        evc = EVC(**attributes)
174 1
        assert evc.primary_path == initial_primary_path
175 1
        with pytest.raises(ValueError) as handle_error:
176 1
            evc.update(**update_dict)
177 1
        assert (
178
            'The EVC must have a primary path or allow dynamic paths.'
179
            in str(handle_error)
180
        )
181
182 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
183 1
    def test_update_empty_backup_path(self, _sync_mock):
184
        """Test if an empty backup path can be set."""
185 1
        initial_backup_path = Path([MagicMock(id=1), MagicMock(id=2)])
186 1
        attributes = {
187
            "controller": get_controller_mock(),
188
            "name": "circuit_name",
189
            "dynamic_backup_path": True,
190
            "backup_path": initial_backup_path,
191
            "enable": True,
192
            "uni_a": get_uni_mocked(is_valid=True),
193
            "uni_z": get_uni_mocked(is_valid=True),
194
        }
195 1
        update_dict = {"backup_path": Path([])}
196 1
        evc = EVC(**attributes)
197 1
        assert evc.backup_path == initial_backup_path
198 1
        evc.update(**update_dict)
199 1
        assert len(evc.backup_path) == 0
200
201 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
202 1
    def test_update_empty_backup_path_non_dynamic(self, _sync_mock):
203
        """Test if an empty backup path can be set even if it's non dynamic."""
204 1
        initial_backup_path = Path([MagicMock(id=1), MagicMock(id=2)])
205 1
        primary_path = Path([MagicMock(id=3), MagicMock(id=4)])
206 1
        attributes = {
207
            "controller": get_controller_mock(),
208
            "name": "circuit_name",
209
            "dynamic_backup_path": False,
210
            "primary_path": primary_path,
211
            "backup_path": initial_backup_path,
212
            "enable": True,
213
            "uni_a": get_uni_mocked(is_valid=True),
214
            "uni_z": get_uni_mocked(is_valid=True),
215
        }
216 1
        update_dict = {"backup_path": Path([])}
217 1
        evc = EVC(**attributes)
218 1
        assert evc.primary_path == primary_path
219 1
        assert evc.backup_path == initial_backup_path
220 1
        evc.update(**update_dict)
221 1
        assert evc.primary_path == primary_path
222 1
        assert len(evc.backup_path) == 0
223
224 1 View Code Duplication
    @patch("napps.kytos.mef_eline.models.EVC.sync")
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
225 1
    def test_update_queue(self, _sync_mock):
226
        """Test if evc is set to redeploy."""
227 1
        attributes = {
228
            "controller": get_controller_mock(),
229
            "name": "circuit_name",
230
            "enable": True,
231
            "dynamic_backup_path": True,
232
            "uni_a": get_uni_mocked(is_valid=True),
233
            "uni_z": get_uni_mocked(is_valid=True),
234
        }
235 1
        update_dict = {"queue_id": 3}
236 1
        evc = EVC(**attributes)
237 1
        _, redeploy = evc.update(**update_dict)
238 1
        assert redeploy
239
240 1 View Code Duplication
    @patch("napps.kytos.mef_eline.models.EVC.sync")
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
241 1
    def test_update_queue_null(self, _sync_mock):
242
        """Test if evc is set to redeploy."""
243 1
        attributes = {
244
            "controller": get_controller_mock(),
245
            "name": "circuit_name",
246
            "enable": True,
247
            "dynamic_backup_path": True,
248
            "uni_a": get_uni_mocked(is_valid=True),
249
            "uni_z": get_uni_mocked(is_valid=True),
250
        }
251 1
        update_dict = {"queue_id": None}
252 1
        evc = EVC(**attributes)
253 1
        _, redeploy = evc.update(**update_dict)
254 1
        assert redeploy
255
256 1
    def test_circuit_representation(self):
257
        """Test the method __repr__."""
258 1
        attributes = {
259
            "controller": get_controller_mock(),
260
            "name": "circuit_name",
261
            "uni_a": get_uni_mocked(is_valid=True),
262
            "uni_z": get_uni_mocked(is_valid=True),
263
        }
264 1
        evc = EVC(**attributes)
265 1
        expected_value = f"EVC({evc.id}, {evc.name})"
266 1
        assert str(evc) == expected_value
267
268 1
    def test_comparison_method(self):
269
        """Test the method __eq__."""
270 1
        attributes = {
271
            "controller": get_controller_mock(),
272
            "name": "circuit_name",
273
            "uni_a": get_uni_mocked(is_valid=True),
274
            "uni_z": get_uni_mocked(is_valid=True),
275
        }
276 1
        evc1 = EVC(**attributes)
277 1
        evc2 = EVC(**attributes)
278
279 1
        attributes = {
280
            "controller": get_controller_mock(),
281
            "name": "circuit_name_2",
282
            "uni_a": get_uni_mocked(is_valid=True),
283
            "uni_z": get_uni_mocked(is_valid=True),
284
        }
285 1
        evc3 = EVC(**attributes)
286 1
        evc4 = EVC(**attributes)
287
288 1
        assert evc1 == evc2
289 1
        assert evc1 != evc3
290 1
        assert evc2 != evc3
291 1
        assert evc3 == evc4
292
293 1
    def test_as_dict(self):
294
        """Test the method as_dict."""
295 1
        attributes = {
296
            "controller": get_controller_mock(),
297
            "id": "custom_id",
298
            "name": "custom_name",
299
            "uni_a": get_uni_mocked(is_valid=True),
300
            "uni_z": get_uni_mocked(is_valid=True),
301
            "start_date": "2018-08-21T18:44:54",
302
            "end_date": "2018-08-21T18:44:55",
303
            "primary_links": [],
304
            "request_time": "2018-08-21T19:10:41",
305
            "creation_time": "2018-08-21T18:44:54",
306
            "owner": "my_name",
307
            "circuit_scheduler": [
308
                CircuitSchedule.from_dict(
309
                    {
310
                        "id": 234243247,
311
                        "action": "create",
312
                        "frequency": "1 * * * *",
313
                    }
314
                ),
315
                CircuitSchedule.from_dict(
316
                    {
317
                        "id": 234243239,
318
                        "action": "create",
319
                        "interval": {"hours": 2},
320
                    }
321
                ),
322
            ],
323
            "enabled": True,
324
            "sb_priority": 2,
325
            "service_level": 7,
326
        }
327 1
        evc = EVC(**attributes)
328
329 1
        expected_dict = {
330
            "id": "custom_id",
331
            "name": "custom_name",
332
            "uni_a": attributes["uni_a"].as_dict(),
333
            "uni_z": attributes["uni_z"].as_dict(),
334
            "start_date": "2018-08-21T18:44:54",
335
            "end_date": "2018-08-21T18:44:55",
336
            "bandwidth": 0,
337
            "primary_links": [],
338
            "backup_links": [],
339
            "current_path": [],
340
            "primary_path": [],
341
            "backup_path": [],
342
            "dynamic_backup_path": False,
343
            "request_time": "2018-08-21T19:10:41",
344
            "creation_time": "2018-08-21T18:44:54",
345
            "circuit_scheduler": [
346
                {
347
                    "id": 234243247,
348
                    "action": "create",
349
                    "frequency": "1 * * * *",
350
                },
351
                {
352
                    "id": 234243239,
353
                    "action": "create",
354
                    "interval": {"hours": 2},
355
                },
356
            ],
357
            "active": False,
358
            "enabled": True,
359
            "sb_priority": 2,
360
            "service_level": 7,
361
        }
362 1
        actual_dict = evc.as_dict()
363 1
        for name, value in expected_dict.items():
364 1
            actual = actual_dict.get(name)
365 1
            assert value == actual
366
367
        # Selected fields
368 1
        expected_dict = {
369
            "enabled": True,
370
            "uni_z": attributes["uni_z"].as_dict(),
371
            "circuit_scheduler": [
372
                {
373
                    "id": 234243247,
374
                    "action": "create",
375
                    "frequency": "1 * * * *",
376
                },
377
                {
378
                    "id": 234243239,
379
                    "action": "create",
380
                    "interval": {"hours": 2},
381
                },
382
            ],
383
            "sb_priority": 2,
384
        }
385 1
        selected_fields = {
386
            "enabled", "uni_z", "circuit_scheduler", "sb_priority"
387
        }
388 1
        actual_dict = evc.as_dict(selected_fields)
389 1
        for name, value in expected_dict.items():
390 1
            actual = actual_dict.get(name)
391 1
            assert value == actual
392
393 1
    @staticmethod
394 1
    def test_get_id_from_cookie():
395
        """Test get_id_from_cookie."""
396 1
        attributes = {
397
            "controller": get_controller_mock(),
398
            "name": "circuit_name",
399
            "enable": True,
400
            "uni_a": get_uni_mocked(is_valid=True),
401
            "uni_z": get_uni_mocked(is_valid=True)
402
        }
403 1
        evc = EVC(**attributes)
404 1
        evc_id = evc.id
405 1
        assert evc_id
406 1
        assert evc.get_id_from_cookie(evc.get_cookie()) == evc_id
407
408 1
    @staticmethod
409 1
    def test_get_id_from_cookie_with_leading_zeros():
410
        """Test get_id_from_cookie with leading zeros."""
411
412 1
        attributes = {
413
            "controller": get_controller_mock(),
414
            "name": "circuit_name",
415
            "enable": True,
416
            "uni_a": get_uni_mocked(is_valid=True),
417
            "uni_z": get_uni_mocked(is_valid=True)
418
        }
419 1
        evc = EVC(**attributes)
420 1
        evc_id = "0a2d672d99ff41"
421
        # pylint: disable=protected-access
422 1
        evc._id = evc_id
423
        # pylint: enable=protected-access
424 1
        assert EVC.get_id_from_cookie(evc.get_cookie()) == evc_id
425
426 1
    def test_is_intra_switch(self):
427
        """Test is_intra_switch method."""
428 1
        attributes = {
429
            "controller": get_controller_mock(),
430
            "name": "circuit_name",
431
            "enable": True,
432
            "uni_a": get_uni_mocked(is_valid=True),
433
            "uni_z": get_uni_mocked(is_valid=True)
434
        }
435 1
        evc = EVC(**attributes)
436 1
        assert not evc.is_intra_switch()
437
438 1
        evc.uni_a.interface.switch = evc.uni_z.interface.switch
439 1
        assert evc.is_intra_switch()
440
441 1
    def test_default_queue_id(self):
442
        """Test default queue_id"""
443
444 1
        attributes = {
445
            "controller": get_controller_mock(),
446
            "name": "circuit_1",
447
            "uni_a": get_uni_mocked(is_valid=True),
448
            "uni_z": get_uni_mocked(is_valid=True),
449
            "dynamic_backup_path": True,
450
        }
451
452 1
        evc = EVC(**attributes)
453 1
        assert evc.queue_id == -1
454
455 1
    def test_get_unis_use_tags(self):
456
        """Test _get_unis_use_tags"""
457 1
        old_uni_a = get_uni_mocked(
458
            interface_port=2,
459
            is_valid=True
460
        )
461 1
        old_uni_z = get_uni_mocked(
462
            interface_port=3,
463
            is_valid=True
464
        )
465 1
        attributes = {
466
            "controller": get_controller_mock(),
467
            "name": "circuit_name",
468
            "enable": True,
469
            "uni_a": old_uni_a,
470
            "uni_z": old_uni_z
471
        }
472 1
        evc = EVC(**attributes)
473 1
        evc._use_uni_vlan = MagicMock()
474 1
        evc.make_uni_vlan_available = MagicMock()
475 1
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
476 1
        new_uni_z = get_uni_mocked(tag_value=200, is_valid=True)
477 1
        unis = {"uni_a": new_uni_a}
478 1
        evc._get_unis_use_tags(**unis)
479 1
        assert evc._use_uni_vlan.call_count == 1
480 1
        assert evc._use_uni_vlan.call_args[0][0] == new_uni_a
481 1
        assert evc.make_uni_vlan_available.call_count == 1
482 1
        assert evc.make_uni_vlan_available.call_args[0][0] == old_uni_a
483
484
        # Two UNIs
485 1
        evc = EVC(**attributes)
486 1
        evc._use_uni_vlan = MagicMock()
487 1
        evc.make_uni_vlan_available = MagicMock()
488 1
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
489 1
        evc._get_unis_use_tags(**unis)
490
491 1
        expected = [call(new_uni_a), call(new_uni_z)]
492 1
        evc._use_uni_vlan.assert_has_calls(expected)
493 1
        expected = [call(old_uni_z), call(old_uni_a)]
494 1
        evc.make_uni_vlan_available.assert_has_calls(expected)
495
496 1
    def test_get_unis_use_tags_error(self):
497
        """Test _get_unis_use_tags with ValueError"""
498 1
        old_uni_a = get_uni_mocked(
499
            interface_port=2,
500
            is_valid=True
501
        )
502 1
        old_uni_z = get_uni_mocked(
503
            interface_port=3,
504
            is_valid=True
505
        )
506 1
        attributes = {
507
            "controller": get_controller_mock(),
508
            "name": "circuit_name",
509
            "enable": True,
510
            "uni_a": old_uni_a,
511
            "uni_z": old_uni_z
512
        }
513 1
        evc = EVC(**attributes)
514 1
        evc._use_uni_vlan = MagicMock()
515
516
        # UNI Z ValueError
517 1
        evc._use_uni_vlan.side_effect = [None, ValueError()]
518 1
        evc.make_uni_vlan_available = MagicMock()
519 1
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
520 1
        new_uni_z = get_uni_mocked(tag_value=200, is_valid=True)
521 1
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
522 1
        with pytest.raises(ValueError):
523 1
            evc._get_unis_use_tags(**unis)
524 1
        expected = [call(new_uni_a), call(new_uni_z)]
525 1
        evc._use_uni_vlan.assert_has_calls(expected)
526 1
        assert evc.make_uni_vlan_available.call_count == 1
527 1
        assert evc.make_uni_vlan_available.call_args[0][0] == new_uni_a
528
529
        # UNI A ValueError
530 1
        evc = EVC(**attributes)
531 1
        evc._use_uni_vlan = MagicMock()
532 1
        evc._use_uni_vlan.side_effect = [ValueError(), None]
533 1
        evc.make_uni_vlan_available = MagicMock()
534 1
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
535 1
        new_uni_z = get_uni_mocked(tag_value=200, is_valid=True)
536 1
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
537 1
        with pytest.raises(ValueError):
538 1
            evc._get_unis_use_tags(**unis)
539 1
        assert evc._use_uni_vlan.call_count == 1
540 1
        assert evc._use_uni_vlan.call_args[0][0] == new_uni_a
541 1
        assert evc.make_uni_vlan_available.call_count == 0
542
543 1
    def test_use_uni_vlan(self):
544
        """Test _use_uni_vlan"""
545 1
        attributes = {
546
            "controller": get_controller_mock(),
547
            "name": "circuit_name",
548
            "enable": True,
549
            "uni_a": get_uni_mocked(is_valid=True),
550
            "uni_z": get_uni_mocked(is_valid=True)
551
        }
552 1
        evc = EVC(**attributes)
553 1
        uni = get_uni_mocked(is_valid=True)
554 1
        uni.interface.use_tags = MagicMock()
555 1
        evc._use_uni_vlan(uni)
556 1
        args = uni.interface.use_tags.call_args[0]
557 1
        assert args[1] == uni.user_tag.value
558 1
        assert args[2] == uni.user_tag.tag_type
559 1
        assert uni.interface.use_tags.call_count == 1
560
561 1
        uni.interface.use_tags.return_value = False
562 1
        with pytest.raises(ValueError):
563 1
            evc._use_uni_vlan(uni)
564 1
        assert uni.interface.use_tags.call_count == 2
565
566 1
        uni.user_tag = None
567 1
        evc._use_uni_vlan(uni)
568 1
        assert uni.interface.use_tags.call_count == 2
569
570 1
    def test_make_uni_vlan_available(self):
571
        """Test make_uni_vlan_available"""
572 1
        attributes = {
573
            "controller": get_controller_mock(),
574
            "name": "circuit_name",
575
            "enable": True,
576
            "uni_a": get_uni_mocked(is_valid=True),
577
            "uni_z": get_uni_mocked(is_valid=True)
578
        }
579 1
        evc = EVC(**attributes)
580 1
        uni = get_uni_mocked(is_valid=True)
581 1
        uni.interface.make_tags_available = MagicMock()
582
583 1
        evc.make_uni_vlan_available(uni)
584 1
        args = uni.interface.make_tags_available.call_args[0]
585 1
        assert args[1] == uni.user_tag.value
586 1
        assert args[2] == uni.user_tag.tag_type
587 1
        assert uni.interface.make_tags_available.call_count == 1
588
589 1
        uni.interface.make_tags_available.return_value = False
590 1
        evc.make_uni_vlan_available(uni)
591 1
        assert uni.interface.make_tags_available.call_count == 2
592
593 1
        uni.user_tag = None
594 1
        evc.make_uni_vlan_available(uni)
595 1
        assert uni.interface.make_tags_available.call_count == 2
596
597 1
    def test_remove_uni_tags(self):
598
        """Test remove_uni_tags"""
599 1
        attributes = {
600
            "controller": get_controller_mock(),
601
            "name": "circuit_name",
602
            "enable": True,
603
            "uni_a": get_uni_mocked(is_valid=True),
604
            "uni_z": get_uni_mocked(is_valid=True)
605
        }
606 1
        evc = EVC(**attributes)
607 1
        evc.make_uni_vlan_available = MagicMock()
608 1
        evc.remove_uni_tags()
609
        assert evc.make_uni_vlan_available.call_count == 2
610