Code Duplication    Length = 24-26 lines in 2 locations

tests/unit/test_main.py 2 locations

@@ 1796-1821 (lines=26) @@
1793
        assert response.status_code == 200
1794
        assert response.json() == expected
1795
1796
    async def test_get_tag_ranges_by_intf(self, event_loop):
1797
        """Test get_tag_ranges_by_intf"""
1798
        self.napp.controller.loop = event_loop
1799
        dpid = '00:00:00:00:00:00:00:01'
1800
        switch = get_switch_mock(dpid)
1801
        interface = get_interface_mock('s1-eth1', 1, switch)
1802
        tags = {'vlan': [[1, 4095]]}
1803
        special_tags = {'vlan': ["vlan"]}
1804
        interface.tag_ranges = tags
1805
        interface.available_tags = tags
1806
        interface.special_available_tags = special_tags
1807
        interface.special_tags = special_tags
1808
        self.napp.controller.get_interface_by_id = MagicMock()
1809
        self.napp.controller.get_interface_by_id.return_value = interface
1810
        url = f"{self.base_endpoint}/interfaces/{dpid}:1/tag_ranges"
1811
        response = await self.api_client.get(url)
1812
        expected = {
1813
            '00:00:00:00:00:00:00:01:1': {
1814
                "available_tags": tags,
1815
                "tag_ranges": tags,
1816
                'special_available_tags': special_tags,
1817
                'special_tags': special_tags
1818
            }
1819
        }
1820
        assert response.status_code == 200
1821
        assert response.json() == expected
1822
1823
    async def test_get_tag_ranges_by_intf_error(self, event_loop):
1824
        """Test get_tag_ranges_by_intf with NotFound"""
@@ 1771-1794 (lines=24) @@
1768
        response = await self.api_client.delete(url)
1769
        assert response.status_code == 400
1770
1771
    async def test_get_all_tag_ranges(self, event_loop):
1772
        """Test get_all_tag_ranges"""
1773
        self.napp.controller.loop = event_loop
1774
        dpid = '00:00:00:00:00:00:00:01'
1775
        switch = get_switch_mock(dpid)
1776
        interface = get_interface_mock('s1-eth1', 1, switch)
1777
        tags = {'vlan': [[1, 4095]]}
1778
        special_tags = {'vlan': ["vlan"]}
1779
        interface.tag_ranges = tags
1780
        interface.available_tags = tags
1781
        interface.special_available_tags = special_tags
1782
        interface.special_tags = special_tags
1783
        switch.interfaces = {1: interface}
1784
        self.napp.controller.switches = {dpid: switch}
1785
        url = f"{self.base_endpoint}/interfaces/tag_ranges"
1786
        response = await self.api_client.get(url)
1787
        expected = {dpid + ":1": {
1788
            'available_tags': tags,
1789
            'tag_ranges': tags,
1790
            'special_available_tags': special_tags,
1791
            'special_tags': special_tags
1792
        }}
1793
        assert response.status_code == 200
1794
        assert response.json() == expected
1795
1796
    async def test_get_tag_ranges_by_intf(self, event_loop):
1797
        """Test get_tag_ranges_by_intf"""