from ows_accounting.presentation import transaction_types def test_long_and_short_names(): """Test format_transaction_types. """ expected_resp = [ { "short_name": "AS", "long_name": "Ad-Supported Audio Streams" }, { "short_name": "AV", "long_name": "Ad-Supported Video Streams" }, { "short_name": "CL", "long_name": "Cloud Match Units" } ] input = [ {'transactiontypedesc': 'Ad-Supported Audio Streams', 'transactiontypeid': '10', 'transactiontypeabbr': 'AS'}, {'transactiontypedesc': 'Ad-Supported Video Streams', 'transactiontypeid': '9', 'transactiontypeabbr': 'AV'}, {'transactiontypedesc': 'Cloud Match Units', 'transactiontypeid': '28', 'transactiontypeabbr': 'CL'} ] resp = transaction_types.long_and_short_names(input) assert resp == expected_resp def test_long_and_short_name(): """Test format_transaction_type. """ expected_resp = { "short_name": "AS", "long_name": "Ad-Supported Audio Streams" } input = { 'transactiontypedesc': 'Ad-Supported Audio Streams', 'transactiontypeid': '10', 'transactiontypeabbr': 'AS' } resp = transaction_types.long_and_short_names(input) assert resp == expected_resp