Move account_settings into user_api.
This commit is contained in:
@@ -64,7 +64,6 @@ urlpatterns = [
|
||||
# noop to squelch ajax errors
|
||||
url(r'^event$', contentstore.views.event, name='event'),
|
||||
url(r'^heartbeat', include('openedx.core.djangoapps.heartbeat.urls')),
|
||||
url(r'^user_api/', include('openedx.core.djangoapps.user_api.legacy_urls')),
|
||||
url(r'^i18n/', include('django.conf.urls.i18n')),
|
||||
|
||||
# User API endpoints
|
||||
|
||||
@@ -83,10 +83,6 @@ urlpatterns = [
|
||||
|
||||
url(r'^heartbeat', include('openedx.core.djangoapps.heartbeat.urls')),
|
||||
|
||||
# Note: these are older versions of the User API that will eventually be
|
||||
# subsumed by api/user listed below.
|
||||
url(r'^user_api/', include('openedx.core.djangoapps.user_api.legacy_urls')),
|
||||
|
||||
url(r'^notifier_api/', include('lms.djangoapps.discussion.notifier_api.urls')),
|
||||
url(r'^/api/notifier/', include('lms.djangoapps.discussion.notifier_api.urls')),
|
||||
|
||||
@@ -106,6 +102,10 @@ urlpatterns = [
|
||||
|
||||
# User API endpoints
|
||||
url(r'^api/user/', include('openedx.core.djangoapps.user_api.urls')),
|
||||
# Note: these are older versions of the User API that will eventually be
|
||||
# subsumed by api/user listed above.
|
||||
url(r'', include('openedx.core.djangoapps.user_api.legacy_urls')),
|
||||
|
||||
|
||||
# Profile Images API endpoints
|
||||
url(r'^api/profile_images/', include('openedx.core.djangoapps.profile_images.urls')),
|
||||
|
||||
@@ -9,6 +9,7 @@ from django.conf.urls import include, url
|
||||
from rest_framework import routers
|
||||
|
||||
from . import views as user_api_views
|
||||
from .accounts.settings_views import account_settings
|
||||
from .models import UserPreference
|
||||
|
||||
USER_API_ROUTER = routers.DefaultRouter()
|
||||
@@ -16,23 +17,24 @@ USER_API_ROUTER.register(r'users', user_api_views.UserViewSet)
|
||||
USER_API_ROUTER.register(r'user_prefs', user_api_views.UserPreferenceViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^v1/', include(USER_API_ROUTER.urls)),
|
||||
url(r'^account/settings$', account_settings, name='account_settings'),
|
||||
url(r'^user_api/v1/', include(USER_API_ROUTER.urls)),
|
||||
url(
|
||||
r'^v1/preferences/(?P<pref_key>{})/users/$'.format(UserPreference.KEY_REGEX),
|
||||
r'^user_api/v1/preferences/(?P<pref_key>{})/users/$'.format(UserPreference.KEY_REGEX),
|
||||
user_api_views.PreferenceUsersListView.as_view()
|
||||
),
|
||||
url(
|
||||
r'^v1/forum_roles/(?P<name>[a-zA-Z]+)/users/$',
|
||||
r'^user_api/v1/forum_roles/(?P<name>[a-zA-Z]+)/users/$',
|
||||
user_api_views.ForumRoleUsersListView.as_view()
|
||||
),
|
||||
|
||||
url(
|
||||
r'^v1/preferences/email_opt_in/$',
|
||||
r'^user_api/v1/preferences/email_opt_in/$',
|
||||
user_api_views.UpdateEmailOptInPreference.as_view(),
|
||||
name="preferences_email_opt_in"
|
||||
),
|
||||
url(
|
||||
r'^v1/preferences/time_zones/$',
|
||||
r'^user_api/v1/preferences/time_zones/$',
|
||||
user_api_views.CountryTimeZoneListView.as_view(),
|
||||
),
|
||||
]
|
||||
|
||||
@@ -108,6 +108,7 @@ class UserAPITestCase(ApiTestCase):
|
||||
self.assertUserIsValid(pref["user"])
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class EmptyUserTestCase(UserAPITestCase):
|
||||
"""
|
||||
Test that the endpoint supports empty user result sets
|
||||
@@ -120,6 +121,7 @@ class EmptyUserTestCase(UserAPITestCase):
|
||||
self.assertEqual(result["results"], [])
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class EmptyRoleTestCase(UserAPITestCase):
|
||||
"""Test that the endpoint supports empty result sets"""
|
||||
course_id = CourseKey.from_string("org/course/run")
|
||||
@@ -154,6 +156,7 @@ class UserApiTestCase(UserAPITestCase):
|
||||
]
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class RoleTestCase(UserApiTestCase):
|
||||
"""
|
||||
Test cases covering Role-related views and their behaviors
|
||||
@@ -243,6 +246,7 @@ class RoleTestCase(UserApiTestCase):
|
||||
self.assertEqual(len(set(all_user_uris)), 5)
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class UserViewSetTest(UserApiTestCase):
|
||||
"""
|
||||
Test cases covering the User DRF view set class and its various behaviors
|
||||
@@ -360,6 +364,7 @@ class UserViewSetTest(UserApiTestCase):
|
||||
)
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class UserPreferenceViewSetTest(CacheIsolationTestCase, UserApiTestCase):
|
||||
"""
|
||||
Test cases covering the User Preference DRF view class and its various behaviors
|
||||
@@ -505,6 +510,7 @@ class UserPreferenceViewSetTest(CacheIsolationTestCase, UserApiTestCase):
|
||||
)
|
||||
|
||||
|
||||
@skip_unless_lms
|
||||
class PreferenceUsersListViewTest(UserApiTestCase):
|
||||
"""
|
||||
Test cases covering the list viewing behavior for user preferences
|
||||
@@ -666,6 +672,7 @@ class UpdateEmailOptInTestCase(UserAPITestCase, SharedModuleStoreTestCase):
|
||||
|
||||
|
||||
@ddt.ddt
|
||||
@skip_unless_lms
|
||||
class CountryTimeZoneListViewTest(UserApiTestCase):
|
||||
"""
|
||||
Test cases covering the list viewing behavior for country time zones
|
||||
|
||||
@@ -13,6 +13,7 @@ from mock import MagicMock, patch
|
||||
from openedx.core.djangoapps.user_api.accounts.utils import retrieve_last_sitewide_block_completed
|
||||
from openedx.core.djangoapps.user_authn import cookies as cookies_api
|
||||
from openedx.core.djangoapps.user_authn.tests.utils import setup_login_oauth_client
|
||||
from openedx.core.djangolib.testing.utils import skip_unless_lms
|
||||
from student.models import CourseEnrollment
|
||||
from student.tests.factories import AnonymousUserFactory, UserFactory
|
||||
|
||||
@@ -33,16 +34,11 @@ class CookieTests(TestCase):
|
||||
def _get_expected_header_urls(self):
|
||||
expected_header_urls = {
|
||||
'logout': reverse('logout'),
|
||||
'resume_block': retrieve_last_sitewide_block_completed(self.user)
|
||||
'resume_block': retrieve_last_sitewide_block_completed(self.user),
|
||||
'account_settings': reverse('account_settings'),
|
||||
'learner_profile': reverse('learner_profile', kwargs={'username': self.user.username}),
|
||||
}
|
||||
|
||||
# Studio (CMS) does not have the URLs below
|
||||
if settings.ROOT_URLCONF == 'lms.urls':
|
||||
expected_header_urls.update({
|
||||
'account_settings': reverse('account_settings'),
|
||||
'learner_profile': reverse('learner_profile', kwargs={'username': self.user.username}),
|
||||
})
|
||||
|
||||
# Convert relative URL paths to absolute URIs
|
||||
for url_name, url_path in six.iteritems(expected_header_urls):
|
||||
expected_header_urls[url_name] = self.request.build_absolute_uri(url_path)
|
||||
@@ -87,6 +83,7 @@ class CookieTests(TestCase):
|
||||
len(set([response.cookies[c]['expires'] for c in response.cookies])),
|
||||
)
|
||||
|
||||
@skip_unless_lms
|
||||
def test_get_user_info_cookie_data(self):
|
||||
actual = cookies_api._get_user_info_cookie_data(self.request, self.user) # pylint: disable=protected-access
|
||||
|
||||
|
||||
@@ -4,14 +4,10 @@ from __future__ import absolute_import
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
|
||||
from openedx.core.djangoapps.user_api.accounts import settings_views
|
||||
|
||||
from .views import login, login_form
|
||||
|
||||
urlpatterns = [
|
||||
# TODO this should really be declared in the user_api app
|
||||
url(r'^account/settings$', settings_views.account_settings, name='account_settings'),
|
||||
|
||||
urlpatterns = [
|
||||
# TODO move contents of urls_common here once CMS no longer has its own login
|
||||
url(r'', include('openedx.core.djangoapps.user_authn.urls_common')),
|
||||
url(r'^account/finish_auth$', login.finish_auth, name='finish_auth'),
|
||||
|
||||
Reference in New Issue
Block a user