Commit 144c3473 by Brian Beggs

Fixes for rebasing of the release on 2015-09-23

parent d6c7d8d3
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
"""Tests for the teams API at the HTTP request level.""" """Tests for the teams API at the HTTP request level."""
import json import json
import pytz
from datetime import datetime from datetime import datetime
import pytz
from dateutil import parser from dateutil import parser
import ddt import ddt
from elasticsearch.exceptions import ConnectionError from elasticsearch.exceptions import ConnectionError
from mock import patch from mock import patch
from search.search_engine_base import SearchEngine from search.search_engine_base import SearchEngine
from django.core.urlresolvers import reverse from django.core.urlresolvers import reverse
from django.conf import settings from django.conf import settings
from django.db.models.signals import post_save from django.db.models.signals import post_save
from django.utils import translation from django.utils import translation
from nose.plugins.attrib import attr from nose.plugins.attrib import attr
from rest_framework.test import APITestCase, APIClient from rest_framework.test import APITestCase, APIClient
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from courseware.tests.factories import StaffFactory from courseware.tests.factories import StaffFactory
from common.test.utils import skip_signal from common.test.utils import skip_signal
from student.tests.factories import UserFactory, AdminFactory, CourseEnrollmentFactory from student.tests.factories import UserFactory, AdminFactory, CourseEnrollmentFactory
from student.models import CourseEnrollment from student.models import CourseEnrollment
from util.testing import EventTestMixin from util.testing import EventTestMixin
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
from xmodule.modulestore.tests.factories import CourseFactory
from .factories import CourseTeamFactory, LAST_ACTIVITY_AT from .factories import CourseTeamFactory, LAST_ACTIVITY_AT
from ..models import CourseTeamMembership from ..models import CourseTeamMembership
from ..search_indexes import CourseTeamIndexer, CourseTeam, course_team_post_save_callback from ..search_indexes import CourseTeamIndexer, CourseTeam, course_team_post_save_callback
from django_comment_common.models import Role, FORUM_ROLE_COMMUNITY_TA from django_comment_common.models import Role, FORUM_ROLE_COMMUNITY_TA
from django_comment_common.utils import seed_permissions_roles from django_comment_common.utils import seed_permissions_roles
...@@ -130,7 +129,7 @@ class TestDashboard(SharedModuleStoreTestCase): ...@@ -130,7 +129,7 @@ class TestDashboard(SharedModuleStoreTestCase):
team.add_user(self.user) team.add_user(self.user)
# Check the query count on the dashboard again # Check the query count on the dashboard again
with self.assertNumQueries(21): with self.assertNumQueries(19):
self.client.get(self.teams_url) self.client.get(self.teams_url)
def test_bad_course_id(self): def test_bad_course_id(self):
......
...@@ -28,9 +28,7 @@ class ExpandableField(Field): ...@@ -28,9 +28,7 @@ class ExpandableField(Field):
if field.source is None: if field.source is None:
field.bind(self.field_name, self) field.bind(self.field_name, self)
# Exclude fields that should not be expanded in the nested field
if should_expand: if should_expand:
nested_expand_fields = set(field.context.get("expand", [])) self.expanded.context["expand"] = set(field.context.get("expand", []))
self.expanded.context["expand"] = list(nested_expand_fields - self.exclude_expand_fields)
return field.to_representation(obj) return field.to_representation(obj)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment