Exemple #1
0
 def test_put_files_scp(self):
     scput = SplitCopyPut()
     scput.progress = MockProgress()
     scput.copy_proto = "scp"
     result = scput.put_files(MockFTP, MockSSHShell, MockSCPClient,
                              ["chunk0", 1999], "/tmp/", {})
     assert result == None
Exemple #2
0
    def test_put_files_scp_auth_fail(self, monkeypatch: MonkeyPatch):
        class MockSSHShell2(MockSSHShell):
            def worker_thread_auth(self):
                return False

        def sleep(secs):
            pass

        monkeypatch.setattr("time.sleep", sleep)
        scput = SplitCopyPut()
        scput.progress = MockProgress()
        scput.copy_proto = "scp"
        with raises(TransferError):
            scput.put_files(MockFTP, MockSSHShell2, MockSCPClient,
                            ["chunk0", 1999], "/tmp/", {})
Exemple #3
0
    def test_put_files_scp_fail(self, monkeypatch: MonkeyPatch):
        class MockSCPClient2(MockSCPClient):
            def put(self, *args):
                raise SCPException

        def sleep(secs):
            pass

        monkeypatch.setattr("time.sleep", sleep)
        scput = SplitCopyPut()
        scput.progress = MockProgress()
        scput.copy_proto = "scp"
        with raises(TransferError):
            scput.put_files(MockFTP, MockSSHShell, MockSCPClient2,
                            ["chunk0", 1999], "/tmp/", {})
Exemple #4
0
    def test_put_files_ftp_sendcmd_fail(self, monkeypatch: MonkeyPatch):
        class MockFTP2(MockFTP):
            def put(self, *args):
                raise error_proto

            def sendcmd(self, cmd):
                raise error_proto

        def sleep(secs):
            pass

        monkeypatch.setattr("time.sleep", sleep)
        scput = SplitCopyPut()
        scput.progress = MockProgress()
        scput.copy_proto = "ftp"
        with raises(TransferError):
            scput.put_files(MockFTP2, MockSSHShell, MockSCPClient,
                            ["chunk0", 1999], "/tmp/", {})