Code Duplication    Length = 64-64 lines in 2 locations

tests/unit/models/test_evc_deploy.py 2 locations

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