Files
edx-platform/cms/djangoapps/contentstore/tests/utils.py
2013-04-16 11:38:58 -04:00

26 lines
508 B
Python

'''
Utilities for contentstore tests
'''
#pylint: disable=W0603
import json
from student.models import Registration
from django.contrib.auth.models import User
def parse_json(response):
"""Parse response, which is assumed to be json"""
return json.loads(response.content)
def user(email):
"""look up a user by email"""
return User.objects.get(email=email)
def registration(email):
"""look up registration object by email"""
return Registration.objects.get(user__email=email)