Code Duplication    Length = 64-64 lines in 2 locations

tests/unit/models/test_evc_deploy.py 2 locations

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