Example #1
0
 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()
Example #2
0
 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)
Example #3
0
 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()
Example #4
0
 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()
Example #5
0
 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()
Example #6
0
 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()
Example #7
0
 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()
Example #8
0
 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()
Example #9
0
 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()