Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 1872-1897 (lines=26) @@
1869
        assert response.status_code == 200
1870
        assert response.json() == expected
1871
1872
    async def test_get_tag_ranges_by_intf(self, event_loop):
1873
        """Test get_tag_ranges_by_intf"""
1874
        self.napp.controller.loop = event_loop
1875
        dpid = '00:00:00:00:00:00:00:01'
1876
        switch = get_switch_mock(dpid)
1877
        interface = get_interface_mock('s1-eth1', 1, switch)
1878
        tags = {'vlan': [[1, 4095]]}
1879
        special_tags = {'vlan': ["vlan"]}
1880
        interface.tag_ranges = tags
1881
        interface.available_tags = tags
1882
        interface.special_available_tags = special_tags
1883
        interface.special_tags = special_tags
1884
        self.napp.controller.get_interface_by_id = MagicMock()
1885
        self.napp.controller.get_interface_by_id.return_value = interface
1886
        url = f"{self.base_endpoint}/interfaces/{dpid}:1/tag_ranges"
1887
        response = await self.api_client.get(url)
1888
        expected = {
1889
            '00:00:00:00:00:00:00:01:1': {
1890
                "available_tags": tags,
1891
                "tag_ranges": tags,
1892
                'special_available_tags': special_tags,
1893
                'special_tags': special_tags
1894
            }
1895
        }
1896
        assert response.status_code == 200
1897
        assert response.json() == expected
1898
1899
    async def test_get_tag_ranges_by_intf_error(self, event_loop):
1900
        """Test get_tag_ranges_by_intf with NotFound"""
@@ 1847-1870 (lines=24) @@
1844
        response = await self.api_client.delete(url)
1845
        assert response.status_code == 400
1846
1847
    async def test_get_all_tag_ranges(self, event_loop):
1848
        """Test get_all_tag_ranges"""
1849
        self.napp.controller.loop = event_loop
1850
        dpid = '00:00:00:00:00:00:00:01'
1851
        switch = get_switch_mock(dpid)
1852
        interface = get_interface_mock('s1-eth1', 1, switch)
1853
        tags = {'vlan': [[1, 4095]]}
1854
        special_tags = {'vlan': ["vlan"]}
1855
        interface.tag_ranges = tags
1856
        interface.available_tags = tags
1857
        interface.special_available_tags = special_tags
1858
        interface.special_tags = special_tags
1859
        switch.interfaces = {1: interface}
1860
        self.napp.controller.switches = {dpid: switch}
1861
        url = f"{self.base_endpoint}/interfaces/tag_ranges"
1862
        response = await self.api_client.get(url)
1863
        expected = {dpid + ":1": {
1864
            'available_tags': tags,
1865
            'tag_ranges': tags,
1866
            'special_available_tags': special_tags,
1867
            'special_tags': special_tags
1868
        }}
1869
        assert response.status_code == 200
1870
        assert response.json() == expected
1871
1872
    async def test_get_tag_ranges_by_intf(self, event_loop):
1873
        """Test get_tag_ranges_by_intf"""