Merge pull request #13706 from edx/jeskew/move_embargo_out_of_common
Move embargo from common to openedx/core/djangoapps.
This commit is contained in:
@@ -368,7 +368,7 @@ MIDDLEWARE_CLASSES = (
|
||||
# Allows us to dark-launch particular languages
|
||||
'openedx.core.djangoapps.dark_lang.middleware.DarkLangMiddleware',
|
||||
|
||||
'embargo.middleware.EmbargoMiddleware',
|
||||
'openedx.core.djangoapps.embargo.middleware.EmbargoMiddleware',
|
||||
|
||||
# Detects user-requested locale from 'accept-language' header in http request
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
@@ -866,7 +866,7 @@ INSTALLED_APPS = (
|
||||
'django_openid_auth',
|
||||
|
||||
# Country embargo support
|
||||
'embargo',
|
||||
'openedx.core.djangoapps.embargo',
|
||||
|
||||
# Monitoring signals
|
||||
'openedx.core.djangoapps.monitoring',
|
||||
|
||||
@@ -20,7 +20,7 @@ from xmodule.modulestore.tests.factories import CourseFactory
|
||||
|
||||
from course_modes.models import CourseMode, Mode
|
||||
from course_modes.tests.factories import CourseModeFactory
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import CourseEnrollmentFactory, UserFactory
|
||||
from util.testing import UrlResetMixin
|
||||
@@ -409,7 +409,7 @@ class CourseModeViewTest(UrlResetMixin, ModuleStoreTestCase):
|
||||
class TrackSelectionEmbargoTest(UrlResetMixin, ModuleStoreTestCase):
|
||||
"""Test embargo restrictions on the track selection page. """
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
|
||||
@@ -23,7 +23,7 @@ from lms.djangoapps.commerce.utils import EcommerceService
|
||||
from course_modes.models import CourseMode
|
||||
from courseware.access import has_access
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
from student.models import CourseEnrollment
|
||||
from util.db import outer_atomic
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ from django.test.utils import override_settings
|
||||
import pytz
|
||||
|
||||
from course_modes.models import CourseMode
|
||||
from embargo.models import CountryAccessRule, Country, RestrictedCourse
|
||||
from enrollment.views import EnrollmentUserThrottle
|
||||
from util.models import RateLimitConfiguration
|
||||
from util.testing import UrlResetMixin
|
||||
@@ -34,7 +33,8 @@ from openedx.core.lib.django_test_client_utils import get_absolute_url
|
||||
from student.models import CourseEnrollment
|
||||
from student.roles import CourseStaffRole
|
||||
from student.tests.factories import AdminFactory, CourseModeFactory, UserFactory
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.models import CountryAccessRule, Country, RestrictedCourse
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
|
||||
|
||||
class EnrollmentTestMixin(object):
|
||||
@@ -925,7 +925,7 @@ class EnrollmentEmbargoTest(EnrollmentTestMixin, UrlResetMixin, ModuleStoreTestC
|
||||
EMAIL = "bob@example.com"
|
||||
PASSWORD = "edx"
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
|
||||
@@ -17,7 +17,7 @@ from rest_framework.response import Response
|
||||
from rest_framework.throttling import UserRateThrottle
|
||||
from rest_framework.views import APIView
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.cors_csrf.authentication import SessionAuthenticationCrossDomainCsrf
|
||||
from openedx.core.djangoapps.cors_csrf.decorators import ensure_csrf_cookie_cross_domain
|
||||
from openedx.core.lib.api.authentication import (
|
||||
|
||||
@@ -12,7 +12,7 @@ from course_modes.models import CourseMode
|
||||
from xmodule.modulestore.tests.django_utils import SharedModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from util.testing import UrlResetMixin
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
from student.tests.factories import UserFactory, CourseModeFactory
|
||||
from student.models import CourseEnrollment, CourseFullError
|
||||
from student.roles import (
|
||||
@@ -32,7 +32,7 @@ class EnrollmentTest(UrlResetMixin, SharedModuleStoreTestCase):
|
||||
USERNAME = "Bob"
|
||||
EMAIL = "bob@example.com"
|
||||
PASSWORD = "edx"
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls):
|
||||
|
||||
@@ -111,7 +111,7 @@ from student.cookies import set_logged_in_cookies, delete_logged_in_cookies
|
||||
from student.models import anonymous_id_for_user, UserAttribute, EnrollStatusChange
|
||||
from shoppingcart.models import DonationConfiguration, CourseRegistrationCode
|
||||
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
|
||||
import analytics
|
||||
from eventtracking import tracker
|
||||
|
||||
@@ -128,7 +128,7 @@ MOCK_MODULES = [
|
||||
'celery',
|
||||
'celery.task',
|
||||
'student.roles',
|
||||
'embargo.models',
|
||||
'openedx.core.djangoapps.embargo.models',
|
||||
'xmodule.vertical_block',
|
||||
'xmodule.course_module',
|
||||
'user_api.accounts.api',
|
||||
|
||||
@@ -22,7 +22,7 @@ from commerce.tests.mocks import mock_basket_order, mock_create_basket
|
||||
from commerce.tests.test_views import UserMixin
|
||||
from course_modes.models import CourseMode
|
||||
from edx_rest_api_client import exceptions
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
from enrollment.api import get_enrollment
|
||||
from openedx.core.lib.django_test_client_utils import get_absolute_url
|
||||
from student.models import CourseEnrollment
|
||||
|
||||
@@ -15,7 +15,7 @@ from commerce.exceptions import InvalidResponseError
|
||||
from commerce.http import DetailResponse, InternalRequestErrorResponse
|
||||
from course_modes.models import CourseMode
|
||||
from courseware import courses
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
from enrollment.api import add_enrollment
|
||||
from enrollment.views import EnrollmentCrossDomainSessionAuth
|
||||
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
|
||||
|
||||
@@ -43,7 +43,7 @@ from courseware.tests.factories import InstructorFactory
|
||||
from student.models import CourseEnrollment
|
||||
from course_modes.models import CourseMode
|
||||
from edxmako.shortcuts import render_to_response
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
from shoppingcart.processors import render_purchase_form_html
|
||||
from shoppingcart.admin import SoftDeleteCouponAdmin
|
||||
from shoppingcart.views import initialize_report
|
||||
@@ -1846,7 +1846,7 @@ class RedeemCodeEmbargoTests(UrlResetMixin, ModuleStoreTestCase):
|
||||
USERNAME = 'bob'
|
||||
PASSWORD = 'test'
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
|
||||
@@ -29,7 +29,7 @@ from config_models.decorators import require_config
|
||||
from shoppingcart.reports import RefundReport, ItemizedPurchaseReport, UniversityRevenueShareReport, CertificateStatusReport
|
||||
from student.models import CourseEnrollment, EnrollmentClosedError, CourseFullError, \
|
||||
AlreadyEnrolledError
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
from .exceptions import (
|
||||
ItemAlreadyInCartException, AlreadyEnrolledInCourseException,
|
||||
CourseDoesNotExistException, ReportTypeDoesNotExistException,
|
||||
|
||||
@@ -281,7 +281,7 @@ class StudentAccountLoginAndRegistrationTest(ThirdPartyAuthTestMixin, UrlResetMi
|
||||
EMAIL = "bob@example.com"
|
||||
PASSWORD = "password"
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
|
||||
@@ -37,7 +37,7 @@ from courseware.url_helpers import get_redirect_url
|
||||
from common.test.utils import XssTestMixin
|
||||
from commerce.models import CommerceConfiguration
|
||||
from commerce.tests import TEST_PAYMENT_DATA, TEST_API_URL, TEST_API_SIGNING_KEY, TEST_PUBLIC_URL_ROOT
|
||||
from embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.embargo.test_utils import restrict_course
|
||||
from openedx.core.djangoapps.user_api.accounts.api import get_account_settings
|
||||
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
|
||||
from shoppingcart.models import Order, CertificateItem
|
||||
@@ -104,7 +104,7 @@ class TestPayAndVerifyView(UrlResetMixin, ModuleStoreTestCase, XssTestMixin):
|
||||
YESTERDAY = NOW - timedelta(days=1)
|
||||
TOMORROW = NOW + timedelta(days=1)
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@mock.patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
|
||||
@@ -35,7 +35,7 @@ from course_modes.models import CourseMode
|
||||
from courseware.url_helpers import get_redirect_url
|
||||
from edx_rest_api_client.exceptions import SlumberBaseException
|
||||
from edxmako.shortcuts import render_to_response, render_to_string
|
||||
from embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.embargo import api as embargo_api
|
||||
from openedx.core.djangoapps.commerce.utils import ecommerce_api_client
|
||||
from openedx.core.djangoapps.user_api.accounts import NAME_MIN_LENGTH
|
||||
from openedx.core.djangoapps.user_api.accounts.api import update_account_settings
|
||||
|
||||
@@ -1143,9 +1143,8 @@ MIDDLEWARE_CLASSES = (
|
||||
|
||||
'splash.middleware.SplashMiddleware',
|
||||
|
||||
|
||||
'openedx.core.djangoapps.geoinfo.middleware.CountryMiddleware',
|
||||
'embargo.middleware.EmbargoMiddleware',
|
||||
'openedx.core.djangoapps.embargo.middleware.EmbargoMiddleware',
|
||||
|
||||
# Allows us to set user preferences
|
||||
'openedx.core.djangoapps.lang_pref.middleware.LanguagePreferenceMiddleware',
|
||||
@@ -2042,7 +2041,7 @@ INSTALLED_APPS = (
|
||||
'rss_proxy',
|
||||
|
||||
# Country embargo support
|
||||
'embargo',
|
||||
'openedx.core.djangoapps.embargo',
|
||||
|
||||
# Monitoring functionality
|
||||
'openedx.core.djangoapps.monitoring',
|
||||
|
||||
@@ -755,7 +755,7 @@ urlpatterns += (
|
||||
# Embargo
|
||||
if settings.FEATURES.get('EMBARGO'):
|
||||
urlpatterns += (
|
||||
url(r'^embargo/', include('embargo.urls')),
|
||||
url(r'^embargo/', include('openedx.core.djangoapps.embargo.urls')),
|
||||
)
|
||||
|
||||
# Survey Djangoapp
|
||||
|
||||
@@ -5,8 +5,12 @@ from django.contrib import admin
|
||||
import textwrap
|
||||
|
||||
from config_models.admin import ConfigurationModelAdmin
|
||||
from embargo.models import IPFilter, CountryAccessRule, RestrictedCourse
|
||||
from embargo.forms import IPFilterForm, RestrictedCourseForm
|
||||
from .models import (
|
||||
IPFilter, CountryAccessRule, RestrictedCourse
|
||||
)
|
||||
from .forms import (
|
||||
IPFilterForm, RestrictedCourseForm
|
||||
)
|
||||
|
||||
|
||||
class IPFilterAdmin(ConfigurationModelAdmin):
|
||||
@@ -15,7 +15,7 @@ from rest_framework import status
|
||||
from ipware.ip import get_ip
|
||||
|
||||
from student.auth import has_course_author_access
|
||||
from embargo.models import CountryAccessRule, RestrictedCourse
|
||||
from .models import CountryAccessRule, RestrictedCourse
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -11,7 +11,7 @@ from xmodule.modulestore.django import modulestore
|
||||
from opaque_keys import InvalidKeyError
|
||||
from opaque_keys.edx.keys import CourseKey
|
||||
|
||||
from embargo.models import IPFilter, RestrictedCourse
|
||||
from .models import IPFilter, RestrictedCourse
|
||||
|
||||
|
||||
class RestrictedCourseForm(forms.ModelForm):
|
||||
@@ -35,8 +35,8 @@ from django.shortcuts import redirect
|
||||
from ipware.ip import get_ip
|
||||
from util.request import course_id_from_url
|
||||
|
||||
from embargo.models import IPFilter
|
||||
from embargo import api as embargo_api
|
||||
from .models import IPFilter
|
||||
from . import api as embargo_api
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -8,7 +8,7 @@ file and check it in at the same time as your model changes. To do that,
|
||||
|
||||
1. Go to the edx-platform dir
|
||||
2. ./manage.py lms schemamigration embargo --auto description_of_your_change
|
||||
3. Add the migration file created in edx-platform/common/djangoapps/embargo/migrations/
|
||||
3. Add the migration file created in edx-platform/openedx/core/djangoapps/embargo/migrations/
|
||||
"""
|
||||
|
||||
import ipaddr
|
||||
@@ -27,8 +27,8 @@ from django_countries import countries
|
||||
from config_models.models import ConfigurationModel
|
||||
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, NoneToEmptyManager
|
||||
|
||||
from embargo.exceptions import InvalidAccessPoint
|
||||
from embargo.messages import ENROLL_MESSAGES, COURSEWARE_MESSAGES
|
||||
from .exceptions import InvalidAccessPoint
|
||||
from .messages import ENROLL_MESSAGES, COURSEWARE_MESSAGES
|
||||
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
@@ -90,6 +90,9 @@ class EmbargoedState(ConfigurationModel):
|
||||
return []
|
||||
return [country.strip().upper() for country in self.embargoed_countries.split(',')]
|
||||
|
||||
def __unicode__(self):
|
||||
return self.embargoed_countries
|
||||
|
||||
|
||||
class RestrictedCourse(models.Model):
|
||||
"""Course with access restrictions.
|
||||
@@ -575,6 +578,7 @@ post_delete.connect(invalidate_country_rule_cache, sender=RestrictedCourse)
|
||||
|
||||
class CourseAccessRuleHistory(models.Model):
|
||||
"""History of course access rule changes. """
|
||||
# pylint: disable=model-missing-unicode
|
||||
|
||||
timestamp = models.DateTimeField(db_index=True, auto_now_add=True)
|
||||
course_key = CourseKeyField(max_length=255, db_index=True)
|
||||
@@ -684,14 +688,14 @@ class IPFilter(ConfigurationModel):
|
||||
for network in self.networks:
|
||||
yield network
|
||||
|
||||
def __contains__(self, ip):
|
||||
def __contains__(self, ip_addr):
|
||||
try:
|
||||
ip = ipaddr.IPAddress(ip)
|
||||
ip_addr = ipaddr.IPAddress(ip_addr)
|
||||
except ValueError:
|
||||
return False
|
||||
|
||||
for network in self.networks:
|
||||
if network.Contains(ip):
|
||||
if network.Contains(ip_addr):
|
||||
return True
|
||||
|
||||
return False
|
||||
@@ -713,3 +717,6 @@ class IPFilter(ConfigurationModel):
|
||||
if self.blacklist == '':
|
||||
return []
|
||||
return self.IPFilterList([addr.strip() for addr in self.blacklist.split(',')])
|
||||
|
||||
def __unicode__(self):
|
||||
return "Whitelist: {} - Blacklist: {}".format(self.whitelist_ips, self.blacklist_ips)
|
||||
@@ -6,7 +6,7 @@ import pygeoip
|
||||
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.core.cache import cache
|
||||
from embargo.models import Country, CountryAccessRule, RestrictedCourse
|
||||
from .models import Country, CountryAccessRule, RestrictedCourse
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
@@ -25,13 +25,13 @@ from student.roles import (
|
||||
OrgStaffRole, OrgInstructorRole
|
||||
)
|
||||
|
||||
from embargo.models import (
|
||||
from ..models import (
|
||||
RestrictedCourse, Country, CountryAccessRule,
|
||||
)
|
||||
|
||||
from util.testing import UrlResetMixin
|
||||
from embargo import api as embargo_api
|
||||
from embargo.exceptions import InvalidAccessPoint
|
||||
from .. import api as embargo_api
|
||||
from ..exceptions import InvalidAccessPoint
|
||||
from mock import patch
|
||||
|
||||
|
||||
@@ -229,6 +229,9 @@ class EmbargoCheckAccessApiTests(ModuleStoreTestCase):
|
||||
|
||||
@contextmanager
|
||||
def _mock_geoip(self, country_code):
|
||||
"""
|
||||
Mock for the GeoIP module.
|
||||
"""
|
||||
with mock.patch.object(pygeoip.GeoIP, 'country_code_by_addr') as mock_ip:
|
||||
mock_ip.return_value = country_code
|
||||
yield
|
||||
@@ -240,7 +243,7 @@ class EmbargoCheckAccessApiTests(ModuleStoreTestCase):
|
||||
class EmbargoMessageUrlApiTests(UrlResetMixin, ModuleStoreTestCase):
|
||||
"""Test the embargo API calls for retrieving the blocking message URLs. """
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
ENABLED_CACHES = ['default', 'mongo_metadata_inheritance', 'loc_cache']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
@@ -9,8 +9,8 @@ from opaque_keys.edx.locator import CourseLocator
|
||||
|
||||
# Explicitly import the cache from ConfigurationModel so we can reset it after each test
|
||||
from config_models.models import cache
|
||||
from embargo.models import IPFilter
|
||||
from embargo.forms import RestrictedCourseForm, IPFilterForm
|
||||
from ..models import IPFilter
|
||||
from ..forms import RestrictedCourseForm, IPFilterForm
|
||||
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from xmodule.modulestore.tests.factories import CourseFactory
|
||||
@@ -40,13 +40,17 @@ class RestrictedCourseFormTest(ModuleStoreTestCase):
|
||||
self._assert_course_field_error(form)
|
||||
|
||||
def _assert_course_field_error(self, form):
|
||||
# Validation shouldn't work
|
||||
"""
|
||||
Validation shouldn't work.
|
||||
"""
|
||||
self.assertFalse(form.is_valid())
|
||||
|
||||
msg = 'COURSE NOT FOUND'
|
||||
self.assertIn(msg, form._errors['course_key'][0]) # pylint: disable=protected-access
|
||||
|
||||
with self.assertRaisesRegexp(ValueError, "The RestrictedCourse could not be created because the data didn't validate."):
|
||||
with self.assertRaisesRegexp(
|
||||
ValueError, "The RestrictedCourse could not be created because the data didn't validate."
|
||||
):
|
||||
form.save()
|
||||
|
||||
|
||||
@@ -111,9 +115,11 @@ class IPFilterFormTest(TestCase):
|
||||
form = IPFilterForm(data=form_data)
|
||||
self.assertFalse(form.is_valid())
|
||||
|
||||
wmsg = "Invalid IP Address(es): [u'.0.0.1', u':dead:beef:::', u'1.0.0.0/55'] Please fix the error(s) and try again."
|
||||
wmsg = "Invalid IP Address(es): [u'.0.0.1', u':dead:beef:::', u'1.0.0.0/55']" \
|
||||
" Please fix the error(s) and try again."
|
||||
self.assertEquals(wmsg, form._errors['whitelist'][0]) # pylint: disable=protected-access
|
||||
bmsg = "Invalid IP Address(es): [u'18.244.*', u'999999:c0a8:101::42', u'1.0.0.0/'] Please fix the error(s) and try again."
|
||||
bmsg = "Invalid IP Address(es): [u'18.244.*', u'999999:c0a8:101::42', u'1.0.0.0/']" \
|
||||
" Please fix the error(s) and try again."
|
||||
self.assertEquals(bmsg, form._errors['blacklist'][0]) # pylint: disable=protected-access
|
||||
|
||||
with self.assertRaisesRegexp(ValueError, "The IPFilter could not be created because the data didn't validate."):
|
||||
@@ -17,8 +17,8 @@ from xmodule.modulestore.tests.factories import CourseFactory
|
||||
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
||||
from config_models.models import cache as config_cache
|
||||
|
||||
from embargo.models import RestrictedCourse, IPFilter
|
||||
from embargo.test_utils import restrict_course
|
||||
from ..models import RestrictedCourse, IPFilter
|
||||
from ..test_utils import restrict_course
|
||||
|
||||
|
||||
@attr(shard=3)
|
||||
@@ -35,7 +35,7 @@ class EmbargoMiddlewareAccessTests(UrlResetMixin, ModuleStoreTestCase):
|
||||
USERNAME = 'fred'
|
||||
PASSWORD = 'secret'
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
@@ -3,7 +3,7 @@ import json
|
||||
from django.test import TestCase
|
||||
from django.db.utils import IntegrityError
|
||||
from opaque_keys.edx.locator import CourseLocator
|
||||
from embargo.models import (
|
||||
from ..models import (
|
||||
EmbargoedCourse, EmbargoedState, IPFilter, RestrictedCourse,
|
||||
Country, CountryAccessRule, CourseAccessRuleHistory
|
||||
)
|
||||
@@ -7,7 +7,7 @@ from django.conf import settings
|
||||
import ddt
|
||||
|
||||
from util.testing import UrlResetMixin
|
||||
from embargo import messages
|
||||
from .. import messages
|
||||
from openedx.core.djangolib.testing.utils import CacheIsolationTestCase
|
||||
from openedx.core.djangoapps.theming.tests.test_util import with_comprehensive_theme
|
||||
|
||||
@@ -34,7 +34,7 @@ class CourseAccessMessageViewTest(CacheIsolationTestCase, UrlResetMixin):
|
||||
|
||||
ENABLED_CACHES = ['default']
|
||||
|
||||
URLCONF_MODULES = ['embargo']
|
||||
URLCONF_MODULES = ['openedx.core.djangoapps.embargo']
|
||||
|
||||
@patch.dict(settings.FEATURES, {'EMBARGO': True})
|
||||
def setUp(self):
|
||||
@@ -2,11 +2,11 @@
|
||||
|
||||
from django.conf.urls import patterns, url
|
||||
|
||||
from embargo.views import CourseAccessMessageView
|
||||
from .views import CourseAccessMessageView
|
||||
|
||||
|
||||
urlpatterns = patterns(
|
||||
'embargo.views',
|
||||
'openedx.core.djangoapps.embargo.views',
|
||||
url(
|
||||
r'^blocked-message/(?P<access_point>enrollment|courseware)/(?P<message_key>.+)/$',
|
||||
CourseAccessMessageView.as_view(),
|
||||
@@ -5,7 +5,7 @@ from django.views.generic.base import View
|
||||
|
||||
from edxmako.shortcuts import render_to_response
|
||||
|
||||
from embargo import messages
|
||||
from . import messages
|
||||
|
||||
|
||||
class CourseAccessMessageView(View):
|
||||
Reference in New Issue
Block a user