finance-watcher / test / api / endpoints / test_helpers.py
test_helpers.py
Raw
from werkzeug.test import TestResponse
from typing import Dict
import ast

BASE_URL = 'https://localhost:3000'

def response_data_to_dict(response: TestResponse) -> Dict:
    """
    Takes in an API response and returns a Dictionary type
    representation.

    :param data: API response data
    """
    dict_str = response.data.decode('UTF-8')
    return ast.literal_eval(dict_str)