Test Failed
Pull Request — master (#371)
by
unknown
07:17
created

TestEVC.test_update_queue()   A

Complexity

Conditions 1

Size

Total Lines 15
Code Lines 13

Duplication

Lines 15
Ratio 100 %

Code Coverage

Tests 6
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 13
nop 2
dl 15
loc 15
ccs 6
cts 6
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
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 1
        [
83
            ("archived", True),
84
            ("_id", True),
85
            ("active", True),
86
            ("current_path", []),
87 1
            ("creation_time", "date"),
88 1
        ]
89 1
    )
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 1
            "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
            evc.update(**update_dict)
105 1
        assert error_message in str(handle_error)
106
107
    def test_update_invalid(self):
108
        """Test updating with an invalid attr"""
109
        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 1
        }
116
        evc = EVC(**attributes)
117 1
        with pytest.raises(ValueError) as handle_error:
118
            evc.update(xyz="abc")
119
        assert (
120
            'The attribute "xyz" is invalid.'
121
            in str(handle_error)
122
        )
123
124
    @patch("napps.kytos.mef_eline.models.EVC.sync")
125 1
    def test_update_disable(self, _sync_mock):
126 1
        """Test if evc is disabled."""
127 1
        attributes = {
128 1
            "controller": get_controller_mock(),
129 1
            "name": "circuit_name",
130 1
            "dynamic_backup_path": True,
131
            "enable": True,
132 1
            "uni_a": get_uni_mocked(is_valid=True),
133
            "uni_z": get_uni_mocked(is_valid=True),
134 1
        }
135
        update_dict = {"enable": False}
136
        evc = EVC(**attributes)
137
        evc.update(**update_dict)
138
        assert evc.is_enabled() is False
139
140
    @patch("napps.kytos.mef_eline.models.EVC.sync")
141 1
    def test_update_empty_primary_path(self, _sync_mock):
142 1
        """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 1
            "enable": True,
150 1
            "uni_a": get_uni_mocked(is_valid=True),
151
            "uni_z": get_uni_mocked(is_valid=True),
152 1
        }
153
        update_dict = {"primary_path": Path([])}
154
        evc = EVC(**attributes)
155
        assert evc.primary_path == initial_primary_path
156
        evc.update(**update_dict)
157
        assert len(evc.primary_path) == 0
158
159
    @patch("napps.kytos.mef_eline.models.EVC.sync")
160 1
    def test_update_empty_path_non_dynamic_backup(self, _sync_mock):
161 1
        """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 1
            "name": "circuit_name",
166 1
            "dynamic_backup_path": False,
167
            "primary_path": initial_primary_path,
168 1
            "enable": True,
169 1
            "uni_a": get_uni_mocked(is_valid=True),
170
            "uni_z": get_uni_mocked(is_valid=True),
171
        }
172
        update_dict = {"primary_path": Path([])}
173
        evc = EVC(**attributes)
174
        assert evc.primary_path == initial_primary_path
175
        with pytest.raises(ValueError) as handle_error:
176
            evc.update(**update_dict)
177
        assert (
178 1
            'The EVC must have a primary path or allow dynamic paths.'
179 1
            in str(handle_error)
180 1
        )
181 1
182 1
    @patch("napps.kytos.mef_eline.models.EVC.sync")
183
    def test_update_empty_backup_path(self, _sync_mock):
184 1
        """Test if an empty backup path can be set."""
185 1
        initial_backup_path = Path([MagicMock(id=1), MagicMock(id=2)])
186
        attributes = {
187 1
            "controller": get_controller_mock(),
188 1
            "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
        update_dict = {"backup_path": Path([])}
196
        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 1
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
        initial_backup_path = Path([MagicMock(id=1), MagicMock(id=2)])
205
        primary_path = Path([MagicMock(id=3), MagicMock(id=4)])
206
        attributes = {
207 1
            "controller": get_controller_mock(),
208 1
            "name": "circuit_name",
209
            "dynamic_backup_path": False,
210 1
            "primary_path": primary_path,
211 1
            "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
        update_dict = {"backup_path": Path([])}
217
        evc = EVC(**attributes)
218
        assert evc.primary_path == primary_path
219
        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 1
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
    def test_update_queue(self, _sync_mock):
226 1
        """Test if evc is set to redeploy."""
227 1
        attributes = {
228
            "controller": get_controller_mock(),
229 1
            "name": "circuit_name",
230 1
            "enable": True,
231 1
            "dynamic_backup_path": True,
232
            "uni_a": get_uni_mocked(is_valid=True),
233
            "uni_z": get_uni_mocked(is_valid=True),
234
        }
235
        update_dict = {"queue_id": 3}
236
        evc = EVC(**attributes)
237
        _, redeploy = evc.update(**update_dict)
238
        assert redeploy
239
240 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 1
        """Test if evc is set to redeploy."""
243 1
        attributes = {
244 1
            "controller": get_controller_mock(),
245 1
            "name": "circuit_name",
246 1
            "enable": True,
247 1
            "dynamic_backup_path": True,
248
            "uni_a": get_uni_mocked(is_valid=True),
249 1
            "uni_z": get_uni_mocked(is_valid=True),
250 1
        }
251
        update_dict = {"queue_id": None}
252 1
        evc = EVC(**attributes)
253
        _, redeploy = evc.update(**update_dict)
254
        assert redeploy
255
256
    def test_circuit_representation(self):
257
        """Test the method __repr__."""
258
        attributes = {
259
            "controller": get_controller_mock(),
260 1
            "name": "circuit_name",
261 1
            "uni_a": get_uni_mocked(is_valid=True),
262 1
            "uni_z": get_uni_mocked(is_valid=True),
263 1
        }
264
        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
        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 1
279 1
        attributes = {
280
            "controller": get_controller_mock(),
281 1
            "name": "circuit_name_2",
282
            "uni_a": get_uni_mocked(is_valid=True),
283 1
            "uni_z": get_uni_mocked(is_valid=True),
284
        }
285
        evc3 = EVC(**attributes)
286
        evc4 = EVC(**attributes)
287
288
        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 1
            "start_date": "2018-08-21T18:44:54",
302 1
            "end_date": "2018-08-21T18:44:55",
303
            "primary_links": [],
304 1
            "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 1
                        "id": 234243247,
311 1
                        "action": "create",
312
                        "frequency": "1 * * * *",
313 1
                    }
314 1
                ),
315 1
                CircuitSchedule.from_dict(
316 1
                    {
317
                        "id": 234243239,
318 1
                        "action": "create",
319
                        "interval": {"hours": 2},
320 1
                    }
321
                ),
322
            ],
323
            "enabled": True,
324
            "sb_priority": 2,
325
            "service_level": 7,
326
        }
327
        evc = EVC(**attributes)
328
329
        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 1
                    "id": 234243239,
353
                    "action": "create",
354 1
                    "interval": {"hours": 2},
355
                },
356
            ],
357
            "active": False,
358
            "enabled": True,
359
            "sb_priority": 2,
360
            "service_level": 7,
361
        }
362
        actual_dict = evc.as_dict()
363
        for name, value in expected_dict.items():
364
            actual = actual_dict.get(name)
365
            assert value == actual
366
367
        # Selected fields
368
        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
        selected_fields = {
386
            "enabled", "uni_z", "circuit_scheduler", "sb_priority"
387 1
        }
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
            assert value == actual
392
393 1
    @staticmethod
394
    def test_get_id_from_cookie():
395
        """Test get_id_from_cookie."""
396
        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
        evc = EVC(**attributes)
404
        evc_id = evc.id
405
        assert evc_id
406
        assert evc.get_id_from_cookie(evc.get_cookie()) == evc_id
407
408
    @staticmethod
409
    def test_get_id_from_cookie_with_leading_zeros():
410 1
        """Test get_id_from_cookie with leading zeros."""
411
412
        attributes = {
413 1
            "controller": get_controller_mock(),
414 1
            "name": "circuit_name",
415 1
            "enable": True,
416 1
            "uni_a": get_uni_mocked(is_valid=True),
417
            "uni_z": get_uni_mocked(is_valid=True)
418 1
        }
419 1
        evc = EVC(**attributes)
420
        evc_id = "0a2d672d99ff41"
421 1
        # pylint: disable=protected-access
422
        evc._id = evc_id
423
        # pylint: enable=protected-access
424
        assert EVC.get_id_from_cookie(evc.get_cookie()) == evc_id
425
426
    def test_is_intra_switch(self):
427
        """Test is_intra_switch method."""
428 1
        attributes = {
429 1
            "controller": get_controller_mock(),
430 1
            "name": "circuit_name",
431 1
            "enable": True,
432
            "uni_a": get_uni_mocked(is_valid=True),
433 1
            "uni_z": get_uni_mocked(is_valid=True)
434 1
        }
435
        evc = EVC(**attributes)
436
        assert not evc.is_intra_switch()
437 1
438
        evc.uni_a.interface.switch = evc.uni_z.interface.switch
439
        assert evc.is_intra_switch()
440
441
    def test_default_queue_id(self):
442
        """Test default queue_id"""
443
444 1
        attributes = {
445 1
            "controller": get_controller_mock(),
446
            "name": "circuit_1",
447 1
            "uni_a": get_uni_mocked(is_valid=True),
448
            "uni_z": get_uni_mocked(is_valid=True),
449 1
            "dynamic_backup_path": True,
450
        }
451 1
452
        evc = EVC(**attributes)
453 1
        assert evc.queue_id == -1
454
455
    def test_get_unis_use_tags(self):
456
        """Test _get_unis_use_tags"""
457
        old_uni_a = get_uni_mocked(
458
            interface_port=2,
459
            is_valid=True
460 1
        )
461 1
        old_uni_z = get_uni_mocked(
462
            interface_port=3,
463 1
            is_valid=True
464 1
        )
465
        attributes = {
466 1
            "controller": get_controller_mock(),
467
            "name": "circuit_name",
468
            "enable": True,
469 1
            "uni_a": old_uni_a,
470
            "uni_z": old_uni_z
471
        }
472
        evc = EVC(**attributes)
473
        evc._use_uni_vlan = MagicMock()
474
        evc.make_uni_vlan_available = MagicMock()
475
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
476
        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
        assert evc._use_uni_vlan.call_count == 1
480
        assert evc._use_uni_vlan.call_args[0][0] == new_uni_a
481
        assert evc.make_uni_vlan_available.call_count == 1
482
        assert evc.make_uni_vlan_available.call_args[0][0] == old_uni_a
483
484
        # Two UNIs
485
        evc = EVC(**attributes)
486
        evc._use_uni_vlan = MagicMock()
487
        evc.make_uni_vlan_available = MagicMock()
488
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
489
        evc._get_unis_use_tags(**unis)
490
491
        expected = [call(new_uni_a), call(new_uni_z)]
492
        evc._use_uni_vlan.assert_has_calls(expected)
493
        expected = [call(old_uni_z), call(old_uni_a)]
494
        evc.make_uni_vlan_available.assert_has_calls(expected)
495
496
    def test_get_unis_use_tags_error(self):
497
        """Test _get_unis_use_tags with ValueError"""
498
        old_uni_a = get_uni_mocked(
499
            interface_port=2,
500
            is_valid=True
501
        )
502
        old_uni_z = get_uni_mocked(
503
            interface_port=3,
504
            is_valid=True
505
        )
506
        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
        evc = EVC(**attributes)
514
        evc._use_uni_vlan = MagicMock()
515
516
        # UNI Z ValueError
517
        evc._use_uni_vlan.side_effect = [None, ValueError()]
518
        evc.make_uni_vlan_available = MagicMock()
519
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
520
        new_uni_z = get_uni_mocked(tag_value=200, is_valid=True)
521
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
522
        with pytest.raises(ValueError):
523
            evc._get_unis_use_tags(**unis)
524
        expected = [call(new_uni_a), call(new_uni_z)]
525
        evc._use_uni_vlan.assert_has_calls(expected)
526
        assert evc.make_uni_vlan_available.call_count == 1
527
        assert evc.make_uni_vlan_available.call_args[0][0] == new_uni_a
528
529
        # UNI A ValueError
530
        evc = EVC(**attributes)
531
        evc._use_uni_vlan = MagicMock()
532
        evc._use_uni_vlan.side_effect = [ValueError(), None]
533
        evc.make_uni_vlan_available = MagicMock()
534
        new_uni_a = get_uni_mocked(tag_value=200, is_valid=True)
535
        new_uni_z = get_uni_mocked(tag_value=200, is_valid=True)
536
        unis = {"uni_a": new_uni_a, "uni_z": new_uni_z}
537
        with pytest.raises(ValueError):
538
            evc._get_unis_use_tags(**unis)
539
        assert evc._use_uni_vlan.call_count == 1
540
        assert evc._use_uni_vlan.call_args[0][0] == new_uni_a
541
        assert evc.make_uni_vlan_available.call_count == 0
542
543
    def test_use_uni_vlan(self):
544
        """Test _use_uni_vlan"""
545
        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
        evc = EVC(**attributes)
553
        uni = get_uni_mocked(is_valid=True)
554
        uni.interface.use_tags = MagicMock()
555
        evc._use_uni_vlan(uni)
556
        args = uni.interface.use_tags.call_args[0]
557
        assert args[1] == [uni.user_tag.value, uni.user_tag.value]
558
        assert args[2] == uni.user_tag.tag_type
559
        assert uni.interface.use_tags.call_count == 1
560
561
        uni.interface.use_tags.return_value = False
562
        with pytest.raises(ValueError):
563
            evc._use_uni_vlan(uni)
564
        assert uni.interface.use_tags.call_count == 2
565
566
        uni.user_tag = None
567
        evc._use_uni_vlan(uni)
568
        assert uni.interface.use_tags.call_count == 2
569
570
    def test_make_uni_vlan_available(self):
571
        """Test make_uni_vlan_available"""
572
        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
        evc = EVC(**attributes)
580
        uni = get_uni_mocked(is_valid=True)
581
        uni.interface.make_tags_available = MagicMock()
582
583
        evc.make_uni_vlan_available(uni)
584
        args = uni.interface.make_tags_available.call_args[0]
585
        assert args[1] == [uni.user_tag.value, uni.user_tag.value]
586
        assert args[2] == uni.user_tag.tag_type
587
        assert uni.interface.make_tags_available.call_count == 1
588
589
        uni.interface.make_tags_available.return_value = False
590
        evc.make_uni_vlan_available(uni)
591
        assert uni.interface.make_tags_available.call_count == 2
592
593
        uni.user_tag = None
594
        evc.make_uni_vlan_available(uni)
595
        assert uni.interface.make_tags_available.call_count == 2
596
597
    def test_remove_uni_tags(self):
598
        """Test remove_uni_tags"""
599
        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
        evc = EVC(**attributes)
607
        evc.make_uni_vlan_available = MagicMock()
608
        evc.remove_uni_tags()
609
        assert evc.make_uni_vlan_available.call_count == 2
610