Ejemplo n.º 1
0
    def test_update_test_case_data(self):
        payload = TestcaseDataPayload()
        payload.guid = "antestcaseguid"
        payload.testcaseAddress = self.id()
        payload.application = "python unittest"
        payload.execution_guid = "executionmachine"
        payload.runtime = 55
        payload.state = "Massachusetts"
        payload.browser = "SeaMonkey"
        self.manager.insert_testcase_data(payload)

        new_payload = TestcaseDataPayload()
        new_payload.runtime = 300
        new_payload.state = "Ohio"
        new_payload.retry_count = 82
        new_payload.guid = "antestcaseguid"
        self.manager.update_testcase_data(new_payload)

        query = """
                        SELECT * FROM testcaseRunData WHERE guid = %(guid)s
                """
        results = DatabaseManager('qa').\
            fetchone_query_and_close(query, {"guid":'antestcaseguid'})

        self.assertTrue(results[0] == 'antestcaseguid')
        self.assertTrue(results[1] == self.id())
        self.assertTrue(results[2] == "python unittest")
        self.assertTrue(results[3] == "executionmachine")
        self.assertTrue(results[4] == 300)
        self.assertTrue(results[5] == 'Ohio')
        self.assertTrue(results[6] == 'SeaMonkey')
        self.assertTrue(results[8] == 82)