Passed
Push — master ( 75d007...4d9626 )
by Humberto
01:10 queued 12s
created

build.tests.integration.test_action   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 19
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestAction.test_all_actions() 0 17 5
1
"""Test Action abstraction for v0x01 and v0x04."""
2
import unittest
3
4
from napps.kytos.of_core.v0x01.flow import Action as Action01
5
from napps.kytos.of_core.v0x04.flow import Action as Action04
6
7
8
class TestAction(unittest.TestCase):
9
    """Tests for the Action class."""
10
11
    def test_all_actions(self):
12
        """Test all action fields from and to dict."""
13
        action_dicts = [
14
            {
15
                'action_type': 'output',
16
                'port': 1},
17
            {
18
                'action_type': 'set_vlan',
19
                'vlan_id': 2},
20
        ]
21
        for action_class in Action01, Action04:
22
            with self.subTest(action_class=action_class):
23
                for expected in action_dicts:
24
                    with self.subTest(expected=expected):
25
                        action = action_class.from_dict(expected)
26
                        actual = action.as_dict()
27
                        self.assertDictEqual(expected, actual)
28