diff --git a/openedx_events/event_bus/avro/tests/test_avro.py b/openedx_events/event_bus/avro/tests/test_avro.py index 2596192f..b42a39e8 100644 --- a/openedx_events/event_bus/avro/tests/test_avro.py +++ b/openedx_events/event_bus/avro/tests/test_avro.py @@ -98,7 +98,7 @@ def generate_test_event_data_for_data_type(data_type): # pragma: no cover defaults_per_type = { int: 1, bool: True, - str: "passing", + str: "default", float: 1.0, CourseKey: CourseKey.from_string("course-v1:edX+DemoX.1+2014"), UsageKey: UsageKey.from_string( diff --git a/openedx_events/event_bus/avro/tests/test_custom_serializers.py b/openedx_events/event_bus/avro/tests/test_custom_serializers.py new file mode 100644 index 00000000..e979a942 --- /dev/null +++ b/openedx_events/event_bus/avro/tests/test_custom_serializers.py @@ -0,0 +1,21 @@ +from unittest import TestCase + +from ccx_keys.locator import CCXLocator + +from openedx_events.event_bus.avro.custom_serializers import ( + CcxCourseLocatorAvroSerializer, +) + + +class TestCCXLocatorSerailizer(TestCase): + def test_serialize(self): + obj1 = CCXLocator(org="edx", course="DemoX", run="Demo_course", ccx="1") + expected1 = "ccx-v1:edx+DemoX+Demo_course+ccx@1" + result1 = CcxCourseLocatorAvroSerializer.serialize(obj1) + self.assertEqual(result1, expected1) + + def test_deseialize(self): + data1 = "ccx-v1:edx+DemoX+Demo_course+ccx@1" + expected1 = CCXLocator(org="edx", course="DemoX", run="Demo_course", ccx="1") + result1 = CcxCourseLocatorAvroSerializer.deserialize(data1) + self.assertEqual(result1, expected1) diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py index 0de3877b..83a76a60 100644 --- a/openedx_events/learning/data.py +++ b/openedx_events/learning/data.py @@ -535,11 +535,7 @@ class CoursePassingStatusData: in which the grade was updated. """ - PASSING = 'passing' - FAILING = 'failing' - STATUSES = [PASSING, FAILING] - - status = attr.ib(type=str, validator=in_(STATUSES)) + status = attr.ib(type=str) course = attr.ib(type=CourseData) user = attr.ib(type=UserData)