"""Physical Reporting Util Tests.""" import pytest from reporting.models.us_physical_product_view import USPhysicalProductView from reporting.utils.physical_reporting import ( get_column_names, get_returns_disposition, translate_params, ) @pytest.mark.parametrize( 'input_params, expected_params', [ ({'x': 1}, {'x': 1}), ( {'x': 1, 'y': 'foo', 'param_subaccount_id': 4}, {'x': 1, 'y': 'foo', 'param_subacct_id': 4}, ), ], ) def test_translate_params(input_params, expected_params): """Test translate params.""" params = translate_params(input_params) assert params == expected_params def test_get_column_names(): """Test getting column names.""" columns = get_column_names(USPhysicalProductView) expected_cols = [ 'Product Name', 'Artist', 'Label Name', 'Sub Label', 'Genre', 'Sub Genre', 'Product Code', 'UPC/EAN', 'Release Date', 'Product Type', 'Format', 'Units Per Set', 'Display Configuration', 'Box Lot', 'Exclusive', 'Exclusive For', 'Orchard Price', 'Wholesale Price', 'On Hand', 'Available', 'Purchase Orders', 'Potential', 'Returns In Process', 'On Hold', 'Open Scrap', 'Product Status', 'Returnability', 'Returns Disposition', '12M Overstock', '24M Overstock', 'Open Orders', 'Backorders', 'Day1S#', 'Day1R#', 'Day1S$', 'Day1R$', '5DayS#', '5DayR#', '5DayS$', '5DayR$', 'MTDS#', 'MTDR#', 'MTDS$', 'MTDR$', '3MS#', '3MR#', '3MS$', '3MR$', '12MS#', '12MR#', '12MS$', '12MR$', '24MS#', '24MR#', '24MS$', '24MR$', 'CYTDS#', 'CYTDR#', 'CYTDS$', 'CYTDR$', 'RTDS#', 'RTDR#', 'RTDS$', 'RTDR$', ] assert columns == expected_cols columns_without_sublabel = get_column_names( USPhysicalProductView, is_d3=False ) expected_cols.remove('Sub Label') assert columns_without_sublabel == expected_cols def test_get_returns_disposition(): """Test returns disposition.""" assert get_returns_disposition('boom', 'override'), 'override' assert get_returns_disposition('boom', 'N'), 'boom' assert get_returns_disposition('boom', 'n '), 'boom' assert get_returns_disposition('boom', None), 'boom'