def set_delayed_test_to_done(self, guid_):
     """ This method updates the delayedTestData table in the DB
         to set the test with the selected guid to done.
         
         :param guid_: The guid that is provided by the test case. (Format: str(uuid.uuid4()))
         
         :returns: True (when no exceptions or errors occur)
     """
     db = DatabaseManager()
     query = """UPDATE delayedTestData
                SET done=TRUE
                WHERE guid=%(guid)s
                AND done=FALSE"""
     db.execute_query_and_close(query, {"guid":guid_})
     return True
    def insert_delayed_test_data(self, guid_, testcase_address, expected_result, done=0, expires_at=DEFAULT_EXPIRATION):
        """ This method inserts rows into the delayedTestData table in the DB based on the
            given parameters where inserted_at (Date format) is automatically set in this method.
            
            :param guid_: The guid that is provided by the test case. (Format: str(uuid.uuid4()))
            :param testcase_address: The ID (address) of the test case.
            :param expected_result: The result string of persistent data that will be stored in the DB.
            :param done: (0 for test not done or 1 for test done)
            
            :returns: True (when no exceptions or errors occur)
        """
        inserted_at = int(time.time() * 1000)

        db = DatabaseManager()
        query = """INSERT INTO delayedTestData(guid,testcaseAddress,insertedAt,expectedResult,done,expiresAt)
                   VALUES (%(guid)s,%(testcaseAddress)s,%(inserted_at)s,%(expected_result)s,%(done)s,%(expires_at)s)"""

        db.execute_query_and_close(query, {"guid":guid_,
                                   "testcaseAddress":testcase_address,
                                   "inserted_at":inserted_at,
                                   "expected_result":expected_result,
                                   "done":done,
                                   "expires_at":inserted_at + expires_at})
        return True