def testFailedGlob(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["src*"], masterdest=self.destdir, glob=True)) self.expect_commands( ExpectGlob(path=os.path.join('wkdir', 'src*'), log_environ=False).files().exit(1)) self.expect_outcome(result=SKIPPED, state_string="uploading 0 files (skipped)") d = self.run_step() return d
def test_glob(self): @defer.inlineCallbacks def testFunc(x): res = yield x.runGlob("*.pyc") self.assertEqual(res, ["one.pyc", "two.pyc"]) self.setup_step(CompositeUser(testFunc)) self.expect_commands( ExpectGlob(path='*.pyc', log_environ=False).files(["one.pyc", "two.pyc"]).exit(0)) self.expect_outcome(result=SUCCESS) return self.run_step()
def testGlob(self): self.setup_step( transfer.MultipleFileUpload(workersrcs=["src*"], masterdest=self.destdir, glob=True)) self.expect_commands( ExpectGlob(path=os.path.join('wkdir', 'src*'), log_environ=False).files(["srcfile"]).exit(0), ExpectStat(file="srcfile", workdir='wkdir').stat_file().exit(0), ExpectUploadFile(workersrc="srcfile", workdir='wkdir', blocksize=16384, maxsize=None, keepstamp=False, writer=ExpectRemoteRef( remotetransfer.FileWriter)).upload_string( "Hello world!\n").exit(0)) self.expect_outcome(result=SUCCESS, state_string="uploading 1 file") d = self.run_step() return d
def test_glob_fail(self): self.setup_step(CompositeUser(lambda x: x.runGlob("*.pyc"))) self.expect_commands( ExpectGlob(path='*.pyc', log_environ=False).exit(1)) self.expect_outcome(result=FAILURE) return self.run_step()