"""Test the transaction type object.""" import pytest from abacus_common_data.transaction_type import TransactionType def test_transaction_type_create_rd(): """Test RD transaction_type.""" rd = TransactionType('RD') assert rd.txn_type_code == 'RD' assert rd.txn_type_id == 13 assert rd.txn_type_desc == 'Download Rentals' def test_transaction_type_unknown_code(): """Tests passing an unknown code.""" with pytest.raises(KeyError): TransactionType('NOTACODE') def test_list_all_txn_types(): """Test list_all_txn_types.""" txn_types = TransactionType.list_all_txn_types() txn_type = txn_types[0] assert txn_type.get('txn_type_code') assert txn_type.get('txn_type_id') assert txn_type.get('txn_type_desc')