Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 1839-1864 (lines=26) @@
1836
        assert response.status_code == 200
1837
        assert response.json() == expected
1838
1839
    async def test_get_tag_ranges_by_intf(self):
1840
        """Test get_tag_ranges_by_intf"""
1841
        self.napp.controller.loop = asyncio.get_running_loop()
1842
        dpid = '00:00:00:00:00:00:00:01'
1843
        switch = get_switch_mock(dpid)
1844
        interface = get_interface_mock('s1-eth1', 1, switch)
1845
        tags = {'vlan': [[1, 4095]]}
1846
        special_tags = {'vlan': ["vlan"]}
1847
        interface.tag_ranges = tags
1848
        interface.available_tags = tags
1849
        interface.special_available_tags = special_tags
1850
        interface.special_tags = special_tags
1851
        self.napp.controller.get_interface_by_id = MagicMock()
1852
        self.napp.controller.get_interface_by_id.return_value = interface
1853
        url = f"{self.base_endpoint}/interfaces/{dpid}:1/tag_ranges"
1854
        response = await self.api_client.get(url)
1855
        expected = {
1856
            '00:00:00:00:00:00:00:01:1': {
1857
                "available_tags": tags,
1858
                "tag_ranges": tags,
1859
                'special_available_tags': special_tags,
1860
                'special_tags': special_tags
1861
            }
1862
        }
1863
        assert response.status_code == 200
1864
        assert response.json() == expected
1865
1866
    async def test_get_tag_ranges_by_intf_error(self):
1867
        """Test get_tag_ranges_by_intf with NotFound"""
@@ 1814-1837 (lines=24) @@
1811
        response = await self.api_client.delete(url)
1812
        assert response.status_code == 400
1813
1814
    async def test_get_all_tag_ranges(self):
1815
        """Test get_all_tag_ranges"""
1816
        self.napp.controller.loop = asyncio.get_running_loop()
1817
        dpid = '00:00:00:00:00:00:00:01'
1818
        switch = get_switch_mock(dpid)
1819
        interface = get_interface_mock('s1-eth1', 1, switch)
1820
        tags = {'vlan': [[1, 4095]]}
1821
        special_tags = {'vlan': ["vlan"]}
1822
        interface.tag_ranges = tags
1823
        interface.available_tags = tags
1824
        interface.special_available_tags = special_tags
1825
        interface.special_tags = special_tags
1826
        switch.interfaces = {1: interface}
1827
        self.napp.controller.switches = {dpid: switch}
1828
        url = f"{self.base_endpoint}/interfaces/tag_ranges"
1829
        response = await self.api_client.get(url)
1830
        expected = {dpid + ":1": {
1831
            'available_tags': tags,
1832
            'tag_ranges': tags,
1833
            'special_available_tags': special_tags,
1834
            'special_tags': special_tags
1835
        }}
1836
        assert response.status_code == 200
1837
        assert response.json() == expected
1838
1839
    async def test_get_tag_ranges_by_intf(self):
1840
        """Test get_tag_ranges_by_intf"""