Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

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