Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

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