Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 1807-1832 (lines=26) @@
1804
        assert response.status_code == 200
1805
        assert response.json() == expected
1806
1807
    async def test_get_tag_ranges_by_intf(self, event_loop):
1808
        """Test get_tag_ranges_by_intf"""
1809
        self.napp.controller.loop = event_loop
1810
        dpid = '00:00:00:00:00:00:00:01'
1811
        switch = get_switch_mock(dpid)
1812
        interface = get_interface_mock('s1-eth1', 1, switch)
1813
        tags = {'vlan': [[1, 4095]]}
1814
        special_tags = {'vlan': ["vlan"]}
1815
        interface.tag_ranges = tags
1816
        interface.available_tags = tags
1817
        interface.special_available_tags = special_tags
1818
        interface.special_tags = special_tags
1819
        self.napp.controller.get_interface_by_id = MagicMock()
1820
        self.napp.controller.get_interface_by_id.return_value = interface
1821
        url = f"{self.base_endpoint}/interfaces/{dpid}:1/tag_ranges"
1822
        response = await self.api_client.get(url)
1823
        expected = {
1824
            '00:00:00:00:00:00:00:01:1': {
1825
                "available_tags": tags,
1826
                "tag_ranges": tags,
1827
                'special_available_tags': special_tags,
1828
                'special_tags': special_tags
1829
            }
1830
        }
1831
        assert response.status_code == 200
1832
        assert response.json() == expected
1833
1834
    async def test_get_tag_ranges_by_intf_error(self, event_loop):
1835
        """Test get_tag_ranges_by_intf with NotFound"""
@@ 1782-1805 (lines=24) @@
1779
        response = await self.api_client.delete(url)
1780
        assert response.status_code == 400
1781
1782
    async def test_get_all_tag_ranges(self, event_loop):
1783
        """Test get_all_tag_ranges"""
1784
        self.napp.controller.loop = event_loop
1785
        dpid = '00:00:00:00:00:00:00:01'
1786
        switch = get_switch_mock(dpid)
1787
        interface = get_interface_mock('s1-eth1', 1, switch)
1788
        tags = {'vlan': [[1, 4095]]}
1789
        special_tags = {'vlan': ["vlan"]}
1790
        interface.tag_ranges = tags
1791
        interface.available_tags = tags
1792
        interface.special_available_tags = special_tags
1793
        interface.special_tags = special_tags
1794
        switch.interfaces = {1: interface}
1795
        self.napp.controller.switches = {dpid: switch}
1796
        url = f"{self.base_endpoint}/interfaces/tag_ranges"
1797
        response = await self.api_client.get(url)
1798
        expected = {dpid + ":1": {
1799
            'available_tags': tags,
1800
            'tag_ranges': tags,
1801
            'special_available_tags': special_tags,
1802
            'special_tags': special_tags
1803
        }}
1804
        assert response.status_code == 200
1805
        assert response.json() == expected
1806
1807
    async def test_get_tag_ranges_by_intf(self, event_loop):
1808
        """Test get_tag_ranges_by_intf"""