def test_clientStatus_afterIdle(self) : s = Server("fixture") s.createServer() s.createProject("myproject") s.createClient("myproject", "myclient") s.clientIdle("myproject", "myclient", 30) self.assertEqual( s.clientStatus("myproject","myclient"), "Idle")
def setUpEmptyClient(project='myproject', client='myclient', **keyw) : s = Server("fixture") s.createServer() s.createProject(project) s.createClient(project,client) s.now = datetime.datetime(1900,1,1,0,0,0) s.clientIdle(project, client, 0) s.setClientMetadata(project,client,**keyw) return s
def test_project_withClients(self) : s = Server("fixture") s.createServer() s.createProject("myproject") s.createClient("myproject","myclient") s.setClientMetadata("myproject", "myclient", description = "a description", briefDescription = "brief description", ) s.createClient("myproject","yourclient") s.setClientMetadata("myproject", "yourclient", description = "your description", briefDescription = "your brief description", ) # force an idle time s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle("myproject", "myclient", 0) s.clientIdle("myproject", "yourclient", 0) s.now = datetime.datetime(2013,9,1,2,3,4) w = JsonSummary() result = w.project(s, 'myproject') self.assertMultiLineEqual(result, '{' ' "project" : "myproject",\n' ' "lastupdate" : "2013/09/01 02:03:04",\n' ' "clients" : [\n' ' {\n' ' "name": "myclient",\n' ' "description": \'a description\',\n' ' "name_details": \'brief description\',\n' ' "status": "int",\n' ' "doing": "old",\n' ' "lastupdate": "2013/04/05 06:07:08",\n' ' "lastExecution": "19000101-000000",\n' ' },\n' ' {\n' ' "name": "yourclient",\n' ' "description": \'your description\',\n' ' "name_details": \'your brief description\',\n' ' "status": "int",\n' ' "doing": "old",\n' ' "lastupdate": "2013/04/05 06:07:08",\n' ' "lastExecution": "19000101-000000",\n' ' },\n' ' ]\n' '}' )
def setUpEmptyClient(self) : s = Server("fixture") s.createServer() s.createProject("myproject") s.createClient("myproject", "myclient") s.setClientMetadata("myproject", "myclient", description = "a description", briefDescription = "brief description", ) # force an idle time s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle("myproject", "myclient", 0) return s
def emptyExecution(self) : 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("myproject", "myclient", 0) e = ArgPrepender(s, project, client, execution) e.executionStarts( timestamp="2013-03-01 23:24:25", changelog=[]) e.executionEnds(True) return e.execution()
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()
]), ]) emulateExecution("client3", "20130305-050607",[ ("Failing task that should not appear in red until execution finishes", [ ("command 1", True, "output", "info", {}), ("command 2", False, "output", "info", {}), ]), ("Example of incomplete task", [ ("command 1", True, "output\n"*12, "info\n"*12, dict( tests = 442, loc = 530, )), ("command 2", None, "output\n"*12, None, {}), ]), ]) s.clientIdle("myproject", "client1", 1) print "Starting generator" w = WebGenerator("www") w.generate(s) print w.generated