Conditions | 5 |
Total Lines | 17 |
Code Lines | 13 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | """Test Action abstraction for v0x01 and v0x04.""" |
||
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 |