Skip to content

Commit

Permalink
test: [ACI-949] increase coverage & fix status field problem (#13)
Browse files Browse the repository at this point in the history
* test: [ACI-949] increase coverage & fix status field problem

* refactor: [ACI-949] remove redundant comments

---------

Co-authored-by: Andrii <[email protected]>
  • Loading branch information
2 people authored and wowkalucky committed Apr 25, 2024
1 parent f7995b9 commit 619289a
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion openedx_events/event_bus/avro/tests/test_avro.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
21 changes: 21 additions & 0 deletions openedx_events/event_bus/avro/tests/test_custom_serializers.py
Original file line number Diff line number Diff line change
@@ -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)
6 changes: 1 addition & 5 deletions openedx_events/learning/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 619289a

Please sign in to comment.