Commit d2f7c81f by Sanford Student

another revert

parent 6659595d
import datetime
import json
import mock
......@@ -13,12 +14,11 @@ from course_discovery.apps.course_metadata.tests.factories import CourseRunFacto
from course_discovery.apps.course_metadata.tests.factories import OrganizationFactory
from course_discovery.apps.publisher.studio_api_utils import StudioAPI
from course_discovery.apps.publisher.tests.factories import CourseRunFactory, OrganizationExtensionFactory
from course_discovery.apps.publisher.tests.utils import MockedStartEndDateTestCase
@freeze_time('2017-01-01T00:00:00Z')
@pytest.mark.django_db
class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
class TestCreateCourseRunInStudio:
@override_switch('enable_publisher_create_course_run_in_studio', active=True)
def test_create_course_run_in_studio_without_partner(self):
with mock.patch('course_discovery.apps.publisher.signals.logger.error') as mock_logger:
......@@ -54,6 +54,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
def test_create_course_run_in_studio(self, mock_access_token): # pylint: disable=unused-argument
organization = OrganizationFactory()
partner = organization.partner
start = datetime.datetime.utcnow()
course_run_key = 'course-v1:TestX+Testing101x+1T2017'
body = {'id': course_run_key}
......@@ -69,6 +70,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
responses.add(responses.POST, url, json=body, status=200)
with mock.patch('course_discovery.apps.publisher.signals.logger.exception') as mock_logger:
publisher_course_run = CourseRunFactory(
start=start,
lms_course_id=None,
course__organizations=[organization]
)
......@@ -92,6 +94,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
partner = organization.partner
course_key = '{org}+{number}'.format(org=organization.key, number=number)
discovery_course_run = DiscoveryCourseRunFactory(course__partner=partner, course__key=course_key)
start = datetime.datetime.utcnow()
course_run_key = 'course-v1:TestX+Testing101x+1T2017'
body = {'id': course_run_key}
......@@ -110,6 +113,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
responses.add(responses.POST, url, json=body, status=200)
publisher_course_run = CourseRunFactory(
start=start,
lms_course_id=None,
course__organizations=[organization],
course__number=number
......@@ -128,6 +132,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
def test_create_course_run_in_studio_with_image_failure(self, __, ___): # pylint: disable=unused-argument
organization = OrganizationFactory()
partner = organization.partner
start = datetime.datetime.utcnow()
course_run_key = 'course-v1:TestX+Testing101x+1T2017'
body = {'id': course_run_key}
......@@ -137,6 +142,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
with mock.patch('course_discovery.apps.publisher.signals.logger.exception') as mock_logger:
publisher_course_run = CourseRunFactory(
start=start,
lms_course_id=None,
course__organizations=[organization]
)
......@@ -153,6 +159,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
def test_create_course_run_in_studio_with_image_api_failure(self, mock_access_token):
organization = OrganizationFactory()
partner = organization.partner
start = datetime.datetime.utcnow()
course_run_key = 'course-v1:TestX+Testing101x+1T2017'
body = {'id': course_run_key}
......@@ -169,6 +176,7 @@ class TestCreateCourseRunInStudio(MockedStartEndDateTestCase):
with mock.patch('course_discovery.apps.publisher.signals.logger.exception') as mock_logger:
publisher_course_run = CourseRunFactory(
start=start,
lms_course_id=None,
course__organizations=[organization]
)
......
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