def begin(self): """At the start of the run, we want to record the execution information to the database.""" exec_payload = ExecutionQueryPayload() exec_payload.execution_start_time = int(time.time() * 1000) self.execution_start_time = exec_payload.execution_start_time exec_payload.guid = self.execution_guid exec_payload.username = getpass.getuser() self.testcase_manager.insert_execution_data(exec_payload)
def test_insert_execution_data(self): payload = ExecutionQueryPayload() payload.guid = "anexecutionguid" payload.execution_start_time = 1234567890 payload.username = "******" self.manager.insert_execution_data(payload) query = """SELECT * FROM execution WHERE guid = %(guid)s""" results = DatabaseManager('qa').fetchone_query_and_close(query, {"guid":'anexecutionguid'}) self.assertTrue(results[0] == 'anexecutionguid') self.assertTrue(results[1] == -1) self.assertTrue(results[2] == 'myself') self.assertTrue(results[3] == 1234567890)