Commit 29d93aff by cahrens

pep8 fixes.

parent 51fc6280
"""
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")
...@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment