def test_process_existing_sha_files(self): output = ("/var/tmp/foo.sha1\n" "/var/tmp/foo.sha224\n" "/var/tmp/foo.sha256\n" "/var/tmp/foo.sha384\n" "/var/tmp/foo.sha512\n") class MockSSHShell2(MockSSHShell): def run(self, cmd): result = True stdout = ( "foo@bar:~$ cat filename\n" "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13 filename\n" "foo@bar:~$ ") return result, stdout scget = SplitCopyGet() scget.sshshell = MockSSHShell2() result = scget.process_existing_sha_files(output) assert result == { 1: "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13", 224: "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13", 256: "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13", 384: "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13", 512: "9771ff758f7b66a7933783b8f2e541ed69031daa0cf233acc9eb42f34f885a13", }
def test_process_existing_sha_files_fail(self): output = "/var/tmp/foo.sha\n" "/var/tmp/foo.sha224\n" class MockSSHShell2(MockSSHShell): def run(self, cmd): return False, "" scget = SplitCopyGet() scget.sshshell = MockSSHShell2() result = scget.process_existing_sha_files(output) assert result == {}