Files
edx-platform/lms/djangoapps/learner_home/mock/mock_views.py
Nathan Sprenkle df47f9df95 refactor: Split learner home experimental / core functionality (#31498)
* refactor: remove old profiling function

* refactor: move mocks into separate directory

* refactor: move recommendations code into a new dir

* docs: docstring consistency and branding updates

* docs: add ADR for core versus experimental code
2023-01-09 10:09:13 -05:00

26 lines
766 B
Python

"""
Mock implementation of the Learner Home.
Returns statically authored JSON data
"""
# pylint: disable=line-too-long
import json
from os import path
from rest_framework.response import Response
from rest_framework.generics import RetrieveAPIView
LEARNER_HOME_DIR = "/edx/app/edxapp/edx-platform/lms/djangoapps/learner_home/mock"
MOCK_DATA_FILE = "mock_data.json"
class InitializeView(RetrieveAPIView):
"""Returns static JSON authored in MOCK_DATA_FILE"""
def get(self, request, *args, **kwargs): # pylint: disable=unused-argument
with open(path.join(LEARNER_HOME_DIR, MOCK_DATA_FILE), "r") as mock_data_file:
# Edit me to change response data
mock_data = json.load(mock_data_file)
return Response(mock_data)