Code Duplication    Length = 64-64 lines in 2 locations

tests/unit/models/test_evc_deploy.py 2 locations

@@ 1843-1906 (lines=64) @@
1840
        result = EVCDeploy.check_list_traces([evc])
1841
        assert result[evc.id] is True
1842
1843
    @patch("napps.kytos.mef_eline.models.evc.log")
1844
    @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces")
1845
    def test_check_list_traces_untagged_cases(self, bulk_sdntraces_mock, _):
1846
        """Test check_list_traces method."""
1847
        evc = self.create_evc_inter_switch("untagged", "untagged")
1848
1849
        for link in evc.primary_links:
1850
            link.metadata['s_vlan'] = MagicMock(value=link.metadata['s_vlan'])
1851
        evc.current_path = evc.primary_links
1852
1853
        trace_a = [
1854
            {
1855
                "dpid": 1,
1856
                "port": 2,
1857
                "time": "t1",
1858
                "type": "starting",
1859
                "vlan": 0
1860
            },
1861
            {
1862
                "dpid": 2,
1863
                "port": 10,
1864
                "time": "t2",
1865
                "type": "intermediary",
1866
                "vlan": 5
1867
            },
1868
            {
1869
                "dpid": 3,
1870
                "port": 12,
1871
                'out': {'port': 3},
1872
                "time": "t3", "type":
1873
                "last",
1874
                "vlan": 6
1875
                },
1876
        ]
1877
        trace_z = [
1878
            {
1879
                "dpid": 3,
1880
                "port": 3,
1881
                "time": "t1",
1882
                "type": "starting",
1883
                "vlan": 0
1884
            },
1885
            {
1886
                "dpid": 2,
1887
                "port": 11,
1888
                "time": "t2",
1889
                "type": "intermediary",
1890
                "vlan": 6
1891
            },
1892
            {
1893
                "dpid": 1,
1894
                "port": 9,
1895
                'out': {'port': 2},
1896
                "time": "t3",
1897
                "type": "last",
1898
                "vlan": 5
1899
            },
1900
        ]
1901
1902
        bulk_sdntraces_mock.return_value = {
1903
                                                "result": [trace_a, trace_z]
1904
                                            }
1905
        result = EVCDeploy.check_list_traces([evc])
1906
        assert result[evc.id] is True
1907
1908
    @patch("napps.kytos.mef_eline.models.evc.log")
1909
    @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces")
@@ 1778-1841 (lines=64) @@
1775
        result = EVCDeploy.check_list_traces([evc])
1776
        assert result[evc.id] is False
1777
1778
    @patch("napps.kytos.mef_eline.models.evc.log")
1779
    @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces")
1780
    def test_check_list_traces_any_cases(self, run_bulk_sdntraces_mock, _):
1781
        """Test check_list_traces method."""
1782
        evc = self.create_evc_inter_switch("any", "any")
1783
1784
        for link in evc.primary_links:
1785
            link.metadata['s_vlan'] = MagicMock(value=link.metadata['s_vlan'])
1786
        evc.current_path = evc.primary_links
1787
1788
        trace_a = [
1789
            {
1790
                "dpid": 1,
1791
                "port": 2,
1792
                "time": "t1",
1793
                "type": "starting",
1794
                "vlan": 1
1795
            },
1796
            {
1797
                "dpid": 2,
1798
                "port": 10,
1799
                "time": "t2",
1800
                "type": "intermediary",
1801
                "vlan": 5
1802
            },
1803
            {
1804
                "dpid": 3,
1805
                "port": 12,
1806
                'out': {'port': 3, 'vlan': 1},
1807
                "time": "t3",
1808
                "type": "last",
1809
                "vlan": 6
1810
            },
1811
        ]
1812
        trace_z = [
1813
            {
1814
                "dpid": 3,
1815
                "port": 3,
1816
                "time": "t1",
1817
                "type": "starting",
1818
                "vlan": 1
1819
            },
1820
            {
1821
                "dpid": 2,
1822
                "port": 11,
1823
                "time": "t2",
1824
                "type": "intermediary",
1825
                "vlan": 6
1826
            },
1827
            {
1828
                "dpid": 1,
1829
                "port": 9,
1830
                'out': {'port': 2, 'vlan': 1},
1831
                "time": "t3",
1832
                "type": "last",
1833
                "vlan": 5
1834
            },
1835
        ]
1836
1837
        run_bulk_sdntraces_mock.return_value = {
1838
                                                "result": [trace_a, trace_z]
1839
                                            }
1840
        result = EVCDeploy.check_list_traces([evc])
1841
        assert result[evc.id] is True
1842
1843
    @patch("napps.kytos.mef_eline.models.evc.log")
1844
    @patch("napps.kytos.mef_eline.models.evc.EVCDeploy.run_bulk_sdntraces")