Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

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