Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

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