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
2c60a7db
Commit
2c60a7db
authored
Jun 25, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8 cleanup
parent
318372f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
14 deletions
+16
-14
cms/djangoapps/auth/tests/test_authz.py
+6
-3
cms/djangoapps/contentstore/tests/test_contentstore.py
+10
-11
No files found.
cms/djangoapps/auth/tests/test_authz.py
View file @
2c60a7db
...
...
@@ -8,10 +8,12 @@ from django.contrib.auth.models import User
from
auth.authz
import
add_user_to_creator_group
,
remove_user_from_creator_group
,
is_user_in_creator_group
class
CreatorGroupTest
(
TestCase
):
"""
Tests for the course creator group.
"""
def
setUp
(
self
):
""" Test case setup """
self
.
user
=
User
.
objects
.
create_user
(
'testuser'
,
'test+courses@edx.org'
,
'foo'
)
...
...
@@ -25,7 +27,7 @@ class CreatorGroupTest(TestCase):
def
test_creator_group_enabled_but_empty
(
self
):
""" Tests creator group feature on, but group empty. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
self
.
assertFalse
(
is_user_in_creator_group
(
self
.
user
))
# Make user staff. This will cause is_user_in_creator_group to return True.
...
...
@@ -34,7 +36,7 @@ class CreatorGroupTest(TestCase):
def
test_creator_group_enabled_nonempty
(
self
):
""" Tests creator group feature on, user added. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
self
.
assertTrue
(
add_user_to_creator_group
(
self
.
user
))
self
.
assertTrue
(
is_user_in_creator_group
(
self
.
user
))
...
...
@@ -62,7 +64,8 @@ class CreatorGroupTest(TestCase):
def
test_course_creation_disabled
(
self
):
""" Tests that the COURSE_CREATION_DISABLED flag overrides course creator group settings. """
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'DISABLE_COURSE_CREATION'
:
True
,
"ENABLE_CREATOR_GROUP"
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'DISABLE_COURSE_CREATION'
:
True
,
"ENABLE_CREATOR_GROUP"
:
True
}):
# Add user to creator group.
self
.
assertTrue
(
add_user_to_creator_group
(
self
.
user
))
...
...
cms/djangoapps/contentstore/tests/test_contentstore.py
View file @
2c60a7db
...
...
@@ -531,7 +531,7 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
self
.
assertGreater
(
len
(
all_assets
),
0
)
# make sure we have some thumbnails in our trashcan
all_thumbnails
=
trash_store
.
get_all_content_thumbnails_for_course
(
course_location
)
_
all_thumbnails
=
trash_store
.
get_all_content_thumbnails_for_course
(
course_location
)
#
# cdodge: temporarily comment out assertion on thumbnails because many environments
# will not have the jpeg converter installed and this test will fail
...
...
@@ -592,20 +592,18 @@ class ContentStoreToyCourseTest(ModuleStoreTestCase):
location
=
Location
(
'i4x://MITx/999/chapter/neuvo'
)
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
clone_item
,
'i4x://edx/templates/chapter/Empty'
,
location
)
location
)
direct_store
.
clone_item
(
'i4x://edx/templates/chapter/Empty'
,
location
)
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
clone_item
,
location
,
location
)
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
clone_item
,
location
,
location
)
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
update_item
,
location
,
'chapter data'
)
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
update_item
,
location
,
'chapter data'
)
# taking advantage of update_children and other functions never checking that the ids are valid
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
update_children
,
location
,
[
'i4x://MITx/999/problem/doesntexist'
])
[
'i4x://MITx/999/problem/doesntexist'
])
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
update_metadata
,
location
,
{
'due'
:
datetime
.
datetime
.
now
(
UTC
)})
{
'due'
:
datetime
.
datetime
.
now
(
UTC
)})
self
.
assertRaises
(
InvalidVersionError
,
draft_store
.
unpublish
,
location
)
...
...
@@ -903,7 +901,8 @@ class ContentStoreTest(ModuleStoreTestCase):
def
test_create_course_with_bad_organization
(
self
):
"""Test new course creation - error path for bad organization name"""
self
.
course_data
[
'org'
]
=
'University of California, Berkeley'
self
.
assert_course_creation_failed
(
"Unable to create course 'Robot Super Course'.
\n\n
Invalid characters in 'University of California, Berkeley'."
)
self
.
assert_course_creation_failed
(
"Unable to create course 'Robot Super Course'.
\n\n
Invalid characters in 'University of California, Berkeley'."
)
def
test_create_course_with_course_creation_disabled_staff
(
self
):
"""Test new course creation -- course creation disabled, but staff access."""
...
...
@@ -924,14 +923,14 @@ class ContentStoreTest(ModuleStoreTestCase):
def
test_create_course_no_course_creators_not_staff
(
self
):
"""Test new course creation -- error path for course creator group enabled, not staff, group is empty."""
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
self
.
user
.
is_staff
=
False
self
.
user
.
save
()
self
.
assert_course_permission_denied
()
def
test_create_course_with_course_creator
(
self
):
"""Test new course creation -- use course creator group"""
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
"ENABLE_CREATOR_GROUP"
:
True
}):
add_user_to_creator_group
(
self
.
user
)
self
.
assert_created_course
()
...
...
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