Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
6f118a3d
Commit
6f118a3d
authored
Mar 03, 2015
by
Andy Armstrong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default profile visibility to off for now
parent
ff72eada
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletions
+26
-1
lms/envs/common.py
+1
-1
openedx/core/djangoapps/user_api/profiles/tests/test_views.py
+25
-0
No files found.
lms/envs/common.py
View file @
6f118a3d
...
...
@@ -2056,7 +2056,7 @@ SEARCH_RESULT_PROCESSOR = "lms.lib.courseware_search.lms_result_processor.LmsSea
PROFILE_CONFIGURATION
=
{
# Default visibility level for accounts without a specified value
# The value is one of: 'all_users', 'private'
"default_visibility"
:
'all_users'
,
"default_visibility"
:
"private"
,
# The list of all fields that can be shown on a learner's profile
"all_fields"
:
[
...
...
openedx/core/djangoapps/user_api/profiles/tests/test_views.py
View file @
6f118a3d
...
...
@@ -7,6 +7,7 @@ import unittest
from
django.conf
import
settings
from
django.core.urlresolvers
import
reverse
from
mock
import
patch
from
openedx.core.djangoapps.user_api.accounts.tests.test_views
import
UserAPITestCase
from
openedx.core.djangoapps.user_api.models
import
UserPreference
...
...
@@ -59,6 +60,10 @@ class TestProfileAPI(UserAPITestCase):
(
"staff_client"
,
"staff_user"
),
)
@ddt.unpack
# Note: using getattr so that the patching works even if there is no configuration.
# This is needed when testing CMS as the patching is still executed even though the
# suite is skipped.
@patch.dict
(
getattr
(
settings
,
"PROFILE_CONFIGURATION"
,
{}),
{
"default_visibility"
:
"all_users"
})
def
test_get_default_profile
(
self
,
api_client
,
username
):
"""
Test that any logged in user can get the main test user's public profile information.
...
...
@@ -74,6 +79,26 @@ class TestProfileAPI(UserAPITestCase):
(
"staff_client"
,
"staff_user"
),
)
@ddt.unpack
# Note: using getattr so that the patching works even if there is no configuration.
# This is needed when testing CMS as the patching is still executed even though the
# suite is skipped.
@patch.dict
(
getattr
(
settings
,
"PROFILE_CONFIGURATION"
,
{}),
{
"default_visibility"
:
"private"
})
def
test_get_default_private_profile
(
self
,
api_client
,
username
):
"""
Test that any logged in user gets only the public fields for a profile
if the default visibility is 'private'.
"""
client
=
self
.
login_client
(
api_client
,
username
)
self
.
create_mock_profile
(
self
.
user
)
response
=
self
.
send_get
(
client
)
self
.
_verify_private_profile_response
(
response
)
@ddt.data
(
(
"client"
,
"user"
),
(
"different_client"
,
"different_user"
),
(
"staff_client"
,
"staff_user"
),
)
@ddt.unpack
def
test_get_private_profile
(
self
,
api_client
,
requesting_username
):
"""
Test that private profile information is only available to the test user themselves.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment