"""Integration test fixture file.""" from datetime import date import json import pytest from api.utils.json import convert_data @pytest.fixture def windows_converted(): """Windowing raw data from API fixture after conversion. Returns: list: converted windowing data. """ return [ { 'label': 'est', 'start_date': date(2015, 9, 1), 'end_date': date(2015, 11, 30) }, { 'label': 'tvod', 'start_date': date(2015, 9, 1), 'end_date': date(2015, 11, 30) }, { 'label': 'airline', 'start_date': date(2015, 9, 1) }, { 'label': 'educational', 'start_date': date(2015, 11, 30) } ] @pytest.fixture def window_model_raw(): """Windowing model data fixture. Returns: list: windowing model data. """ return [ { 'label': 'est', 'start_date': date(2015, 9, 1), 'end_date': date(2015, 11, 30), 'status': 'window' }, { 'label': 'tvod', 'start_date': date(2015, 9, 1), 'end_date': date(2015, 11, 30), 'status': 'window' }, { 'label': 'airline', 'start_date': date(2015, 9, 1), 'status': 'window' }, { 'label': 'educational', 'start_date': date(2015, 11, 30), 'status': 'window' } ] def stringify_api_output(output): """Convert API response into string objects. Args: output (list): API output with python objects. Returns: list: API output with python objects coverted to strings. """ return json.loads(json.dumps(output, default=convert_data))