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
29d93aff
Commit
29d93aff
authored
Jun 19, 2013
by
cahrens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
pep8 fixes.
parent
51fc6280
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
11 deletions
+25
-11
cms/djangoapps/contentstore/tests/test_course_settings.py
+25
-11
No files found.
cms/djangoapps/contentstore/tests/test_course_settings.py
View file @
29d93aff
"""
Tests for Studio Course Settings.
"""
import
datetime
import
datetime
import
json
import
json
import
copy
import
copy
...
@@ -23,6 +26,9 @@ from xmodule.fields import Date
...
@@ -23,6 +26,9 @@ from xmodule.fields import Date
class
CourseTestCase
(
ModuleStoreTestCase
):
class
CourseTestCase
(
ModuleStoreTestCase
):
"""
Base class for test classes below.
"""
def
setUp
(
self
):
def
setUp
(
self
):
"""
"""
These tests need a user in the DB so that the django Test Client
These tests need a user in the DB so that the django Test Client
...
@@ -53,6 +59,9 @@ class CourseTestCase(ModuleStoreTestCase):
...
@@ -53,6 +59,9 @@ class CourseTestCase(ModuleStoreTestCase):
class
CourseDetailsTestCase
(
CourseTestCase
):
class
CourseDetailsTestCase
(
CourseTestCase
):
"""
Tests the first course settings page (course dates, overview, etc.).
"""
def
test_virgin_fetch
(
self
):
def
test_virgin_fetch
(
self
):
details
=
CourseDetails
.
fetch
(
self
.
course_location
)
details
=
CourseDetails
.
fetch
(
self
.
course_location
)
self
.
assertEqual
(
details
.
course_location
,
self
.
course_location
,
"Location not copied into"
)
self
.
assertEqual
(
details
.
course_location
,
self
.
course_location
,
"Location not copied into"
)
...
@@ -83,9 +92,9 @@ class CourseDetailsTestCase(CourseTestCase):
...
@@ -83,9 +92,9 @@ class CourseDetailsTestCase(CourseTestCase):
Test the encoder out of its original constrained purpose to see if it functions for general use
Test the encoder out of its original constrained purpose to see if it functions for general use
"""
"""
details
=
{
'location'
:
Location
([
'tag'
,
'org'
,
'course'
,
'category'
,
'name'
]),
details
=
{
'location'
:
Location
([
'tag'
,
'org'
,
'course'
,
'category'
,
'name'
]),
'number'
:
1
,
'number'
:
1
,
'string'
:
'string'
,
'string'
:
'string'
,
'datetime'
:
datetime
.
datetime
.
now
(
UTC
())}
'datetime'
:
datetime
.
datetime
.
now
(
UTC
())}
jsondetails
=
json
.
dumps
(
details
,
cls
=
CourseSettingsEncoder
)
jsondetails
=
json
.
dumps
(
details
,
cls
=
CourseSettingsEncoder
)
jsondetails
=
json
.
loads
(
jsondetails
)
jsondetails
=
json
.
loads
(
jsondetails
)
...
@@ -123,10 +132,8 @@ class CourseDetailsTestCase(CourseTestCase):
...
@@ -123,10 +132,8 @@ class CourseDetailsTestCase(CourseTestCase):
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'dummy-root'
})
@override_settings
(
MKTG_URLS
=
{
'ROOT'
:
'dummy-root'
})
def
test_marketing_site_fetch
(
self
):
def
test_marketing_site_fetch
(
self
):
settings_details_url
=
reverse
(
'settings_details'
,
settings_details_url
=
reverse
(
'settings_details'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'name'
:
self
.
course_location
.
name
,
'name'
:
self
.
course_location
.
name
,
'course'
:
self
.
course_location
.
course
})
'course'
:
self
.
course_location
.
course
})
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
True
}):
response
=
self
.
client
.
get
(
settings_details_url
)
response
=
self
.
client
.
get
(
settings_details_url
)
...
@@ -144,10 +151,8 @@ class CourseDetailsTestCase(CourseTestCase):
...
@@ -144,10 +151,8 @@ class CourseDetailsTestCase(CourseTestCase):
def
test_regular_site_fetch
(
self
):
def
test_regular_site_fetch
(
self
):
settings_details_url
=
reverse
(
'settings_details'
,
settings_details_url
=
reverse
(
'settings_details'
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
kwargs
=
{
'org'
:
self
.
course_location
.
org
,
'name'
:
self
.
course_location
.
name
,
'name'
:
self
.
course_location
.
name
,
'course'
:
self
.
course_location
.
course
})
'course'
:
self
.
course_location
.
course
})
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
False
}):
with
mock
.
patch
.
dict
(
'django.conf.settings.MITX_FEATURES'
,
{
'ENABLE_MKTG_SITE'
:
False
}):
response
=
self
.
client
.
get
(
settings_details_url
)
response
=
self
.
client
.
get
(
settings_details_url
)
...
@@ -165,6 +170,9 @@ class CourseDetailsTestCase(CourseTestCase):
...
@@ -165,6 +170,9 @@ class CourseDetailsTestCase(CourseTestCase):
class
CourseDetailsViewTest
(
CourseTestCase
):
class
CourseDetailsViewTest
(
CourseTestCase
):
"""
Tests for modifying content on the first course settings page (course dates, overview, etc.).
"""
def
alter_field
(
self
,
url
,
details
,
field
,
val
):
def
alter_field
(
self
,
url
,
details
,
field
,
val
):
setattr
(
details
,
field
,
val
)
setattr
(
details
,
field
,
val
)
# Need to partially serialize payload b/c the mock doesn't handle it correctly
# Need to partially serialize payload b/c the mock doesn't handle it correctly
...
@@ -226,6 +234,9 @@ class CourseDetailsViewTest(CourseTestCase):
...
@@ -226,6 +234,9 @@ class CourseDetailsViewTest(CourseTestCase):
class
CourseGradingTest
(
CourseTestCase
):
class
CourseGradingTest
(
CourseTestCase
):
"""
Tests for the course settings grading page.
"""
def
test_initial_grader
(
self
):
def
test_initial_grader
(
self
):
descriptor
=
get_modulestore
(
self
.
course_location
)
.
get_item
(
self
.
course_location
)
descriptor
=
get_modulestore
(
self
.
course_location
)
.
get_item
(
self
.
course_location
)
test_grader
=
CourseGradingModel
(
descriptor
)
test_grader
=
CourseGradingModel
(
descriptor
)
...
@@ -301,6 +312,9 @@ class CourseGradingTest(CourseTestCase):
...
@@ -301,6 +312,9 @@ class CourseGradingTest(CourseTestCase):
class
CourseMetadataEditingTest
(
CourseTestCase
):
class
CourseMetadataEditingTest
(
CourseTestCase
):
"""
Tests for CourseMetadata.
"""
def
setUp
(
self
):
def
setUp
(
self
):
CourseTestCase
.
setUp
(
self
)
CourseTestCase
.
setUp
(
self
)
# add in the full class too
# add in the full class too
...
...
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