Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

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