Commit caab0b97 by Clinton Blackburn

Pulling the course start/end dates from Drupal (#116)

ECOM-4543
parent 3a983295
...@@ -348,9 +348,12 @@ class DrupalApiDataLoader(AbstractDataLoader): ...@@ -348,9 +348,12 @@ class DrupalApiDataLoader(AbstractDataLoader):
except CourseRun.DoesNotExist: except CourseRun.DoesNotExist:
logger.warning('Could not find course run [%s]', course_run_key) logger.warning('Could not find course run [%s]', course_run_key)
return None return None
course_run.language = self.get_language_tag(body) course_run.language = self.get_language_tag(body)
course_run.course = course course_run.course = course
course_run.marketing_url = urljoin(settings.MARKETING_URL_ROOT, body['course_about_uri']) course_run.marketing_url = urljoin(settings.MARKETING_URL_ROOT, body['course_about_uri'])
course_run.start = self.parse_date(body['start'])
course_run.end = self.parse_date(body['end'])
self.set_staff(course_run, body) self.set_staff(course_run, body)
......
...@@ -467,6 +467,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase): ...@@ -467,6 +467,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase):
'items': [ 'items': [
{ {
'title': self.EXISTING_COURSE_AND_RUN_DATA[0]['title'], 'title': self.EXISTING_COURSE_AND_RUN_DATA[0]['title'],
'start': '2015-06-15T13:00:00Z',
'end': '2015-12-15T13:00:00Z',
'level': { 'level': {
'title': 'Introductory', 'title': 'Introductory',
}, },
...@@ -502,6 +504,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase): ...@@ -502,6 +504,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase):
}, },
{ {
'title': self.EXISTING_COURSE_AND_RUN_DATA[1]['title'], 'title': self.EXISTING_COURSE_AND_RUN_DATA[1]['title'],
'start': '2015-06-15T13:00:00Z',
'end': '2015-12-15T13:00:00Z',
'level': { 'level': {
'title': 'Intermediate', 'title': 'Intermediate',
}, },
...@@ -525,6 +529,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase): ...@@ -525,6 +529,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase):
}, },
{ # Create a course which exists in LMS/Otto, but without course runs { # Create a course which exists in LMS/Otto, but without course runs
'title': self.EXISTING_COURSE['title'], 'title': self.EXISTING_COURSE['title'],
'start': '2015-06-15T13:00:00Z',
'end': '2015-12-15T13:00:00Z',
'level': { 'level': {
'title': 'Advanced', 'title': 'Advanced',
}, },
...@@ -551,6 +557,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase): ...@@ -551,6 +557,8 @@ class DrupalApiDataLoaderTests(DataLoaderTestMixin, TestCase):
}, },
{ # Create a fake course run which doesn't exist in LMS/Otto { # Create a fake course run which doesn't exist in LMS/Otto
'title': 'A partial course', 'title': 'A partial course',
'start': '2015-06-15T13:00:00Z',
'end': '2015-12-15T13:00:00Z',
'level': { 'level': {
'title': 'Advanced', 'title': 'Advanced',
}, },
......
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