'Tests course creation workflow when course organization exist in system.'

@patch.dict('django.conf.settings.FEATURES', {'ORGANIZATIONS_APP': True})
@ddt.data(ModuleStoreEnum.Type.mongo, ModuleStoreEnum.Type.split)
def test_course_creation_with_org_in_system(self, store):

    add_organization({'name': 'Test    Organization', 'short_name': 'orgX', 'description': 'Testing    Organization    Description'})
    with modulestore().default_store(store):
        response = self.client.ajax_post(self.course_create_rerun_url, {'org': 'orgX', 'number': 'CS101', 'display_name': 'Course    with    web    certs    enabled', 'run': '2015_T2'})
        self.assertEqual(response.status_code, 200)
        data = parse_json(response)
        new_course_key = CourseKey.from_string(data['course_key'])
        course_orgs = get_course_organizations(new_course_key)
        self.assertEqual(len(course_orgs), 1)
        self.assertEqual(course_orgs[0]['short_name'], 'orgX')
