Skip to content

Commit

Permalink
Merge pull request #677 from edx/bexline/enterprise_catalog_migration
Browse files Browse the repository at this point in the history
ENT-2475 Removing unnecessary json encoding in the client data
  • Loading branch information
brittneyexline authored Jan 14, 2020
2 parents ee3ddc0 + 54d3992 commit c004fc4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@ Change Log

.. There should always be an "Unreleased" section for changes pending release.
[2.0.48] - 2020-01-14
---------------------

* Updated enterprise catalog client json formatting.

[2.0.47] - 2020-01-13
---------------------

Expand Down
2 changes: 1 addition & 1 deletion enterprise/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@

from __future__ import absolute_import, unicode_literals

__version__ = "2.0.47"
__version__ = "2.0.48"

default_app_config = "enterprise.apps.EnterpriseConfig" # pylint: disable=invalid-name
4 changes: 2 additions & 2 deletions enterprise/api_client/enterprise_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ def create_enterprise_catalog(
'uuid': catalog_uuid,
'title': title,
'enterprise_customer': enterprise_id,
'content_filter': json.dumps(content_filter),
'enabled_course_modes': json.dumps(enabled_course_modes),
'content_filter': content_filter,
'enabled_course_modes': enabled_course_modes,
'publish_audit_enrollment_urls': json.dumps(publish_audit_enrollment_urls),
}
return endpoint.post(post_data)
Expand Down
16 changes: 8 additions & 8 deletions tests/test_enterprise/api_client/test_enterprise_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ def test_create_enterprise_catalog():
'uuid': TEST_ENTERPRISE_CATALOG_UUID,
'enterprise_customer': TEST_ENTERPRISE_ID,
'title': 'Test Catalog',
'content_filter': '{\"content_type\": \"course\"}',
'enabled_course_modes': '[\"verified\"]',
'content_filter': {"content_type": "course"},
'enabled_course_modes': ["verified"],
'publish_audit_enrollment_urls': 'false',
}
responses.add(
Expand Down Expand Up @@ -72,8 +72,8 @@ def test_get_enterprise_catalog():
'catalog_uuid': TEST_ENTERPRISE_CATALOG_UUID,
'enterprise_customer': TEST_ENTERPRISE_ID,
'title': 'Test Catalog',
'content_filter': '{"content_type":"course"}',
'enabled_course_modes': '["verified"]',
'content_filter': {"content_type": "course"},
'enabled_course_modes': ["verified"],
'publish_audit_enrollment_urls': False,
}
responses.add(
Expand All @@ -93,8 +93,8 @@ def test_update_enterprise_catalog():
'catalog_uuid': TEST_ENTERPRISE_CATALOG_UUID,
'enterprise_customer': TEST_ENTERPRISE_ID,
'title': 'Test Catalog',
'content_filter': '{"content_type":"course"}',
'enabled_course_modes': '["verified"]',
'content_filter': {"content_type": "course"},
'enabled_course_modes': ["verified"],
'publish_audit_enrollment_urls': False,
}
responses.add(
Expand All @@ -105,11 +105,11 @@ def test_update_enterprise_catalog():
client = enterprise_catalog.EnterpriseCatalogApiClient('staff-user-goes-here')
actual_response = client.update_enterprise_catalog(
TEST_ENTERPRISE_CATALOG_UUID,
content_filter='{"content_type":"course"}'
content_filter={"content_type": "course"}
)
assert actual_response == expected_response
request = responses.calls[0][0]
assert json.loads(request.body) == {'content_filter': '{"content_type":"course"}'}
assert json.loads(request.body) == {'content_filter': {"content_type": "course"}}


@responses.activate
Expand Down

0 comments on commit c004fc4

Please sign in to comment.