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
80613361
Commit
80613361
authored
Oct 14, 2014
by
Will Daly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move user_service into user_api/api
parent
61dbd70c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
15 deletions
+19
-15
common/djangoapps/user_api/api/course_tag.py
+0
-0
common/djangoapps/user_api/tests/test_course_tag_api.py
+7
-7
lms/lib/xblock/runtime.py
+12
-8
No files found.
common/djangoapps/user_api/
user_service
.py
→
common/djangoapps/user_api/
api/course_tag
.py
View file @
80613361
File moved
common/djangoapps/user_api/tests/test_
user_service
.py
→
common/djangoapps/user_api/tests/test_
course_tag_api
.py
View file @
80613361
"""
Test the user
service
Test the user
course tag API.
"""
from
django.test
import
TestCase
from
student.tests.factories
import
UserFactory
from
user_api
import
user_service
from
user_api
.api
import
course_tag
as
course_tag_api
from
opaque_keys.edx.locations
import
SlashSeparatedCourseKey
...
...
@@ -19,17 +19,17 @@ class TestUserService(TestCase):
def
test_get_set_course_tag
(
self
):
# get a tag that doesn't exist
tag
=
user_service
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
tag
=
course_tag_api
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
self
.
assertIsNone
(
tag
)
# test setting a new key
test_value
=
'value'
user_service
.
set_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
,
test_value
)
tag
=
user_service
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
course_tag_api
.
set_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
,
test_value
)
tag
=
course_tag_api
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
self
.
assertEqual
(
tag
,
test_value
)
#test overwriting an existing key
test_value
=
'value2'
user_service
.
set_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
,
test_value
)
tag
=
user_service
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
course_tag_api
.
set_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
,
test_value
)
tag
=
course_tag_api
.
get_course_tag
(
self
.
user
,
self
.
course_id
,
self
.
test_key
)
self
.
assertEqual
(
tag
,
test_value
)
lms/lib/xblock/runtime.py
View file @
80613361
...
...
@@ -7,7 +7,7 @@ import xblock.reference.plugins
from
django.core.urlresolvers
import
reverse
from
django.conf
import
settings
from
user_api
import
user_service
from
user_api
.api
import
course_tag
as
user_course_tag_api
from
xmodule.modulestore.django
import
modulestore
from
xmodule.x_module
import
ModuleSystem
from
xmodule.partitions.partitions_service
import
PartitionService
...
...
@@ -144,7 +144,7 @@ class UserTagsService(object):
the current course id and current user.
"""
COURSE_SCOPE
=
user_
service
.
COURSE_SCOPE
COURSE_SCOPE
=
user_
course_tag_api
.
COURSE_SCOPE
def
__init__
(
self
,
runtime
):
self
.
runtime
=
runtime
...
...
@@ -161,11 +161,13 @@ class UserTagsService(object):
scope: the current scope of the runtime
key: the key for the value we want
"""
if
scope
!=
user_
service
.
COURSE_SCOPE
:
if
scope
!=
user_
course_tag_api
.
COURSE_SCOPE
:
raise
ValueError
(
"unexpected scope {0}"
.
format
(
scope
))
return
user_service
.
get_course_tag
(
self
.
_get_current_user
(),
self
.
runtime
.
course_id
,
key
)
return
user_course_tag_api
.
get_course_tag
(
self
.
_get_current_user
(),
self
.
runtime
.
course_id
,
key
)
def
set_tag
(
self
,
scope
,
key
,
value
):
"""
...
...
@@ -175,11 +177,13 @@ class UserTagsService(object):
key: the key that to the value to be set
value: the value to set
"""
if
scope
!=
user_
service
.
COURSE_SCOPE
:
if
scope
!=
user_
course_tag_api
.
COURSE_SCOPE
:
raise
ValueError
(
"unexpected scope {0}"
.
format
(
scope
))
return
user_service
.
set_course_tag
(
self
.
_get_current_user
(),
self
.
runtime
.
course_id
,
key
,
value
)
return
user_course_tag_api
.
set_course_tag
(
self
.
_get_current_user
(),
self
.
runtime
.
course_id
,
key
,
value
)
class
LmsModuleSystem
(
LmsHandlerUrls
,
ModuleSystem
):
# pylint: disable=abstract-method
...
...
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