def test_executionTable_twoSameDay(self) : s = self.setUpProject() self.setUpClient("client 1") self.setUpClient("client 2") self.setUpExecution("client 1", "20130304-050607", running=True) self.setUpExecution("client 2", "20130304-050607", running=True) w = ProjectHistory() result = w.executionTable(s, "myproject") self.assertMultiLineEqual(result, '<tr><td colspan="2">2013/03/04</td></tr>\n' '<tr>\n' '<td>\n' '<a href="details-client 1-20130304-050607.html"\n' ' title="Running. Click to see the details"\n' ' class="executionbubble running">\n' '<div>client 1 :: brief description</div>\n' '<div><b>Started:</b> 2013/03/04 05:06:07</div>\n' '<div>in progress...</div>\n' '</a>\n' '</td>\n' '<td>\n' '<a href="details-client 2-20130304-050607.html"\n' ' title="Running. Click to see the details"\n' ' class="executionbubble running">\n' '<div>client 2 :: brief description</div>\n' '<div><b>Started:</b> 2013/03/04 05:06:07</div>\n' '<div>in progress...</div>\n' '</a>\n' '</td>\n' '</tr>\n' )
def test_executionsByDay(self) : w = ProjectHistory() clientsExecutions = { 'myclient1' : [ '20130101-000000', '20130101-200000', '20130101-300000', '20130102-300000', '20130103-300000', ], 'myclient2' : [ '20130101-300000', '20130103-100000', '20130103-300000', '20130104-300000', ], } self.assertEqual( w.executionsByDay(clientsExecutions), [ ('20130104', [ ('myclient1', [ ]), ('myclient2', [ '20130104-300000', ]), ]), ('20130103', [ ('myclient1', [ '20130103-300000', ]), ('myclient2', [ '20130103-300000', '20130103-100000', ]), ]), ('20130102', [ ('myclient1', [ '20130102-300000', ]), ('myclient2', [ ]), ]), ('20130101', [ ('myclient1', [ '20130101-300000', '20130101-200000', '20130101-000000', ]), ('myclient2', [ '20130101-300000', ]), ]), ])
def test_execution_running(self) : s = self.setUpProject() self.setUpClient("myclient") self.setUpExecution("myclient", "20130304-050607", running=True) w = ProjectHistory() result = w.execution(s, "myproject", "myclient", "20130304-050607") self.assertMultiLineEqual(result, '<a href="details-myclient-20130304-050607.html"\n' ' title="Running. Click to see the details"\n' ' class="executionbubble running">\n' "<div>myclient :: brief description</div>\n" "<div><b>Started:</b> 2013/03/04 05:06:07</div>\n" "<div>in progress...</div>\n" '</a>\n' )
def test_execution_red(self) : s = self.setUpProject() self.setUpClient("myclient") self.setUpExecution("myclient", "20130304-050607", ok=False) w = ProjectHistory() result = w.execution(s, "myproject", "myclient", "20130304-050607") self.assertMultiLineEqual(result, '<a href="details-myclient-20130304-050607.html"\n' ' title="Broken. Click to see the details"\n' ' class="executionbubble broken">\n' "<div>myclient :: brief description</div>\n" "<div><b>Started:</b> 2013/03/04 05:06:07</div>\n" "<div><b>Finished:</b> 2013/04/05 06:07:08</div>\n" '</a>\n' )
def test_clientStatus_red(self) : s = self.setUpProject() self.setUpClient("myclient") self.setUpExecution("myclient", "20130102-050607", ok=False) s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle("myproject", "myclient", 1) w = ProjectHistory() data = s.client("myproject", "myclient") result = w.clientStatus(data) self.assertMultiLineEqual(result, '<td>\n' ' <div class="client_status broken">Broken</div>\n' ' <div class="client_doing wait">Next run:<br />\n' ' 2013/04/05 06:08:08</div>\n' '</td>\n' )
def test_clientStatus_running(self) : s = self.setUpProject() self.setUpClient("myclient") self.setUpExecution("myclient", "20130102-050607", running=True) # force an idle time s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle("myproject", "myclient", 1) w = ProjectHistory() s.now=datetime.datetime(2013,9,5,6,7,8) data = s.client("myproject", "myclient") result = w.clientStatus(data) self.assertMultiLineEqual(result, '<td>\n' ' <div class="client_status unknown">Unknown</div>\n' ' <div class="client_doing run">Running since:<br />\n' ' 2013/01/02 05:06:07</div>\n' '</td>\n' )
def test_clientStatus_old(self) : s = self.setUpProject() self.setUpClient("myclient") self.setUpExecution("myclient", "20130102-050607") # force an idle time s.now=datetime.datetime(2013,4,5,6,7,8) s.clientIdle("myproject", "myclient", 1) w = ProjectHistory() s.now=datetime.datetime(2013,9,5,6,7,8) data = s.client("myproject", "myclient") result = w.clientStatus(data) self.assertMultiLineEqual(result, '<td>\n' ' <div class="client_status stable">Stable</div>\n' ' <div class="client_doing old">Not responding since:<br />\n' ' 2013/04/05 06:08:08</div>\n' '</td>\n' )