示例#1
0
    def test_basic(self):
        out = run_script("--version")
        assert out == __version__

        out = run_script("--help")
        assert "usage: pyftpsync" in out

        out = run_script("foobar", expect_code=2)
示例#2
0
 def test_match_all(self):
     out = run_script("scan", self.local, "--list", "--recursive")
     self.assert_scan_equal(
         out,
         [
             "file1.txt",
             "file2.txt",
             "file3.txt",
             "file4.txt",
             "file5.txt",
             "file6.txt",
             "file7.txt",
             "file8.txt",
             "file9.txt",
             "[folder1]",
             "file1_1.txt",
             "[folder2]",
             "file2_1.txt",
             "[folder3]",
             "file3_1.txt",
             "[folder4]",
             "file4_1.txt",
             "[folder5]",
             "file5_1.txt",
             "[folder6]",
             "file6_1.txt",
             "[folder7]",
             "file7_1.txt",
         ],
     )
示例#3
0
    def test_issue_21(self):
        if not self.use_ftp_target:
            raise SkipTest("Only FTP targets.")
        write_test_file("local/large.txt", size=10 * 1000)
        write_test_file("remote/large.txt", size=10 * 1000)

        out = run_script("download", "-vvv", self.local_url, self.remote_url)
        #         print(out)
        assert not ("*cmd* 'PORT" in out or "*cmd* 'EPRT" in out)
        assert "*cmd* 'PASV" in out or "*cmd* 'EPSV" in out

        out = run_script("download", self.local_url, self.remote_url, "-vvv",
                         "--ftp-active")
        #         print(out)
        assert "*cmd* 'PORT" in out or "*cmd* 'EPRT" in out
        assert not ("*cmd* 'PASV" in out or "*cmd* 'EPSV" in out)
示例#4
0
    def test_issue_21(self):
        if not self.use_ftp_target:
            raise SkipTest("Only FTP targets.")
        write_test_file("local/large.txt", size=10 * 1000)
        write_test_file("remote/large.txt", size=10 * 1000)

        out = run_script("download", "-vvv", self.local_url, self.remote_url)
        #         print(out)
        assert not ("*cmd* 'PORT" in out or "*cmd* 'EPRT" in out)
        assert "*cmd* 'PASV" in out or "*cmd* 'EPSV" in out

        out = run_script(
            "download", self.local_url, self.remote_url, "-vvv", "--ftp-active"
        )
        #         print(out)
        assert "*cmd* 'PORT" in out or "*cmd* 'EPRT" in out
        assert not ("*cmd* 'PASV" in out or "*cmd* 'EPSV" in out)
示例#5
0
 def test_match_5b(self):
     out = run_script(
         "scan",
         self.local,
         "--list",
         "--recursive",
         "--match",
         "*5*",
         "--exclude",
         "folder?",
     )
     self.assert_scan_equal(out, ["file5.txt"])
示例#6
0
 def test_match_5(self):
     out = run_script("scan", self.local, "--list", "--recursive",
                      "--match", "*5*")
     self.assert_scan_equal(out, [
         'file5.txt',
         '[folder1]',
         '[folder2]',
         '[folder3]',
         '[folder4]',
         '[folder5]',
         'file5_1.txt',
         '[folder6]',
         '[folder7]',
     ])
示例#7
0
 def test_match_5(self):
     out = run_script("scan", self.local, "--list", "--recursive", "--match", "*5*")
     self.assert_scan_equal(
         out,
         [
             "file5.txt",
             "[folder1]",
             "[folder2]",
             "[folder3]",
             "[folder4]",
             "[folder5]",
             "file5_1.txt",
             "[folder6]",
             "[folder7]",
         ],
     )
示例#8
0
 def test_match_flat(self):
     out = run_script("scan", self.local, "--list")
     self.assert_scan_equal(out, [
         'file1.txt',
         'file2.txt',
         'file3.txt',
         'file4.txt',
         'file5.txt',
         'file6.txt',
         'file7.txt',
         'file8.txt',
         'file9.txt',
         '[folder1]',
         '[folder2]',
         '[folder3]',
         '[folder4]',
         '[folder5]',
         '[folder6]',
         '[folder7]',
     ])
示例#9
0
 def test_match_flat(self):
     out = run_script("scan", self.local, "--list")
     self.assert_scan_equal(
         out,
         [
             "file1.txt",
             "file2.txt",
             "file3.txt",
             "file4.txt",
             "file5.txt",
             "file6.txt",
             "file7.txt",
             "file8.txt",
             "file9.txt",
             "[folder1]",
             "[folder2]",
             "[folder3]",
             "[folder4]",
             "[folder5]",
             "[folder6]",
             "[folder7]",
         ],
     )
示例#10
0
 def test_download(self):
     out = run_script("download", self.local, self.remote, "--dry-run")
     assert "(DRY-RUN) Wrote 0/16 files in 7 directories, skipped: 0." in out
示例#11
0
 def test_scan_list(self):
     out = run_script("scan", self.local, "--list")
     # We expect "file1.txt [spaces] 2014-01-01 13:00:00"
     # but the time zone may be different on the travis server, so we relax:
     assert re.search("file1.txt\s+2014-01-01 \d\d:00:00", out)