def log_transaction(self, message, typing='TRANSACTION', commit=True): if not isinstance(message, str): raise TypeError('ERROR: Message must be of type string') if typing not in OracleDB.types: raise ValueError('ERROR: typing must be a defined log type') self._db.insert_into_Logs(TIME.get_timestamp(), typing, message, commit)
def test_LD_insert_message_failure(): logDB = LD.LogDatabase() with pytest.raises(TypeError): logDB.insert_into_Logs(TIME.get_timestamp(), 'TRANSACTION', 18)
def test_LD_insert_log(): logDB = LD.LogDatabase() logDB.insert_into_Logs(TIME.get_timestamp(), 'TRANSACTION', 'This is a TEST Transaction Message')
def test_LD_insert_type_failure(): logDB = LD.LogDatabase() with pytest.raises(ValueError): logDB.insert_into_Logs(TIME.get_timestamp(), 'INVALID TYPE', 'This is a TEST Transaction Message')