def test_render(self): self.setupStep(worker.FileExists(file=properties.Property("x"))) self.properties.setProperty('x', 'XXX', 'here') self.expectCommands(Expect('stat', {'file': 'XXX'}) + 1) self.expectOutcome(result=FAILURE, state_string="File not found. (failure)") return self.runStep()
def test_old_version(self): self.setupStep(worker.FileExists(file="x"), worker_version=dict()) self.expectOutcome(result=EXCEPTION, state_string="finished (exception)") yield self.runStep() self.flushLoggedErrors(WorkerTooOldError)
def test_found(self): self.setupStep(worker.FileExists(file="x")) self.expectCommands( Expect('stat', {'file': 'x'}) + Expect.update('stat', [stat.S_IFREG, 99, 99]) + 0) self.expectOutcome(result=SUCCESS, state_string="File found.") return self.runStep()
def test_render(self): self.setup_step(worker.FileExists(file=properties.Property("x"))) self.properties.setProperty('x', 'XXX', 'here') self.expect_commands(ExpectStat(file='XXX').exit(1)) self.expect_outcome(result=FAILURE, state_string="File not found. (failure)") return self.run_step()
def test_not_found(self): self.setupStep(worker.FileExists(file="x")) self.expectCommands( Expect('stat', {'file': 'x'}) + Expect.update('stat', [0, 99, 99]) + 0) self.expectOutcome(result=FAILURE, state_string="Not a file. (failure)") return self.runStep()
def test_failure(self): self.setupStep(worker.FileExists(file="x")) self.expectCommands( Expect('stat', {'file': 'x'}) + 1 ) self.expectOutcome(result=FAILURE, state_string="File not found. (failure)") return self.runStep()
def test_found(self): self.setup_step(worker.FileExists(file="x")) self.expect_commands(ExpectStat(file='x').stat_file().exit(0)) self.expect_outcome(result=SUCCESS, state_string="File found.") return self.run_step()
def test_failure(self): self.setup_step(worker.FileExists(file="x")) self.expect_commands(ExpectStat(file='x').exit(1)) self.expect_outcome(result=FAILURE, state_string="File not found. (failure)") return self.run_step()
def test_not_found(self): self.setup_step(worker.FileExists(file="x")) self.expect_commands(ExpectStat(file='x').stat(mode=0).exit(0)) self.expect_outcome(result=FAILURE, state_string="Not a file. (failure)") return self.run_step()