* asadiqbal08/SOL-1058: Add edx-organizations to certificate web view * Support organization logo asset management * Remove organization fields from Studio certificate configuration model * SOL-981 pull request feedback fixes
52 lines
2.0 KiB
Python
52 lines
2.0 KiB
Python
"""
|
|
Tests for the organizations helpers library, which is the integration point for the edx-organizations API
|
|
"""
|
|
from mock import patch
|
|
|
|
from util import organizations_helpers
|
|
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
|
|
from xmodule.modulestore.tests.factories import CourseFactory
|
|
|
|
|
|
@patch.dict('django.conf.settings.FEATURES', {'ORGANIZATIONS_APP': False})
|
|
class OrganizationsHelpersTestCase(ModuleStoreTestCase):
|
|
"""
|
|
Main test suite for Organizations API client library
|
|
"""
|
|
|
|
def setUp(self):
|
|
"""
|
|
Test case scaffolding
|
|
"""
|
|
super(OrganizationsHelpersTestCase, self).setUp(create_user=False)
|
|
self.course = CourseFactory.create()
|
|
|
|
self.organization = {
|
|
'name': 'Test Organization',
|
|
'description': 'Testing Organization Helpers Library',
|
|
}
|
|
|
|
def test_get_organization_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.get_organization(1)
|
|
self.assertEqual(len(response), 0)
|
|
|
|
def test_get_organizations_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.get_organizations()
|
|
self.assertEqual(len(response), 0)
|
|
|
|
def test_get_organization_courses_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.get_organization_courses(1)
|
|
self.assertEqual(len(response), 0)
|
|
|
|
def test_get_course_organizations_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.get_course_organizations(unicode(self.course.id))
|
|
self.assertEqual(len(response), 0)
|
|
|
|
def test_add_organization_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.add_organization(organization_data=self.organization)
|
|
self.assertIsNone(response)
|
|
|
|
def test_add_organization_course_returns_none_when_app_disabled(self):
|
|
response = organizations_helpers.add_organization_course(self.organization, self.course.id)
|
|
self.assertIsNone(response)
|