def setUpExecution(self, client, name, ok=True, running=False) : s = Server("fixture") e = ArgPrepender(s, "myproject", client, name) timestamp = "{:%Y-%m-%d %H:%M:%S}".format( datetime.datetime.strptime(name, "%Y%m%d-%H%M%S")) e.executionStarts( timestamp= timestamp, changelog=[]) e.taskStarts(1,"First task") if running : return e.taskEnds(1,ok) e.executionEnds(ok)
def setUpExecution(self, server, name, running=False, ok=True) : e = ArgPrepender(server, "myproject", "myclient", name) timestamp = "{:%Y-%m-%d %H:%M:%S}".format( datetime.datetime.strptime(name, "%Y%m%d-%H%M%S")) e.executionStarts( timestamp= timestamp, changelog=[]) e.taskStarts(1, "First task") e.commandStarts(1,1, "command line") e.commandEnds(1,1, output="output", ok=ok, info=None, stats={}) if running : return e.taskEnds(1,ok) e.executionEnds(ok)
def executionFixture(self, running = False) : project, client, execution = "myproject", "myclient", "20130301-232425" s = Server("fixture") s.createServer() s.createProject(project) s.createClient(project, client) # force an idle time s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle(project,client, 0) e = ArgPrepender(s, project, client, execution) e.executionStarts( timestamp="2013-03-01 23:24:25", changelog=[]) e.taskStarts(1, "First task") e.commandStarts(1,1, "command line") if running : return e.execution() e.commandEnds(1,1, output="output", ok=True, info=None, stats={}) e.taskEnds(1,True) e.executionEnds(True) return e.execution()
def commandFixture(self, line, running = False, ok = None, output=None, info=None, stats = {} ) : project, client, execution = "myproject", "myclient", "20130301-232425" s = Server("fixture") s.createServer() s.createProject(project) s.createClient(project, client) e = ArgPrepender(s, project, client, execution) e.executionStarts( timestamp="2013-03-01 23:24:25", changelog=[]) e.taskStarts(1, "First task") e.commandStarts(1,1, line) if running : return e.execution().tasks[0].commands[0] e.commandEnds(1,1, output=output, ok=ok, info=info, stats=stats) e.taskEnds(1,True) e.executionEnds(True) return e.execution().tasks[0].commands[0]
def taskFixture(self, description, commands = 0, id = 1, running = False, ok = None, info=None, stats = {} ) : project, client, execution = "myproject", "myclient", "20130301-232425" s = Server("fixture") e = ArgPrepender(s, project, client, execution) e.executionStarts( timestamp="2013-03-01 23:24:25", changelog=[]) e.taskStarts(id, description) for i in xrange(commands) : output="output for command {}".format(i) ok = True e.commandStarts(id,i+1, "command line") if running : return e.execution().tasks[0] e.commandEnds(id,i+1, output=output, ok=ok, info=info, stats=stats) e.taskEnds(id,True) e.executionEnds(True) return e.execution().tasks[id-1]