From 6a918eb6ed6428fb77cff58bdfccfd7e62d33c5c Mon Sep 17 00:00:00 2001
From: andrii-hantkovskyi
 <131773947+andrii-hantkovskyi@users.noreply.github.com>
Date: Thu, 18 Apr 2024 17:16:19 +0300
Subject: [PATCH] fix: [ACI-152] fix ci failure (#12)

* fix: [ACI-152] fix django tests failure

* style: [ACI-152] adjust code style to pylint requirements

---------

Co-authored-by: Andrii <andrii.hantkovskyi@raccoongang.com>
---
 ...x+course+passing+status+updated+v1_schema.avsc} |  2 +-
 ...g+course+passing+status+updated+v1_schema.avsc} |  2 +-
 openedx_events/event_bus/avro/tests/test_avro.py   |  4 +++-
 openedx_events/learning/data.py                    | 14 ++++++++++----
 openedx_events/learning/signals.py                 |  4 ++--
 5 files changed, 17 insertions(+), 9 deletions(-)
 rename openedx_events/event_bus/avro/tests/schemas/{org+openedx+learning+ccx+course+passing+status+v1_schema.avsc => org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc} (97%)
 rename openedx_events/event_bus/avro/tests/schemas/{org+openedx+learning+course+passing+status+v1_schema.avsc => org+openedx+learning+course+passing+status+updated+v1_schema.avsc} (97%)

diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc
similarity index 97%
rename from openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc
rename to openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc
index 2f0056aad..81bc1a2e2 100644
--- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+v1_schema.avsc
+++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+ccx+course+passing+status+updated+v1_schema.avsc
@@ -104,5 +104,5 @@
       }
     }
   ],
-  "namespace": "org.openedx.learning.ccx.course.passing.status.v1"
+  "namespace": "org.openedx.learning.ccx.course.passing.status.updated.v1"
 }
\ No newline at end of file
diff --git a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc
similarity index 97%
rename from openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc
rename to openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc
index 085c11c1d..a20b821f9 100644
--- a/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+v1_schema.avsc
+++ b/openedx_events/event_bus/avro/tests/schemas/org+openedx+learning+course+passing+status+updated+v1_schema.avsc
@@ -88,5 +88,5 @@
       }
     }
   ],
-  "namespace": "org.openedx.learning.course.passing.status.v1"
+  "namespace": "org.openedx.learning.course.passing.status.updated.v1"
 }
\ No newline at end of file
diff --git a/openedx_events/event_bus/avro/tests/test_avro.py b/openedx_events/event_bus/avro/tests/test_avro.py
index bf2f18368..2596192f6 100644
--- a/openedx_events/event_bus/avro/tests/test_avro.py
+++ b/openedx_events/event_bus/avro/tests/test_avro.py
@@ -5,6 +5,7 @@
 from typing import List
 from unittest import TestCase
 
+from ccx_keys.locator import CCXLocator
 from fastavro import schemaless_reader, schemaless_writer
 from fastavro.repository.base import SchemaRepositoryError
 from fastavro.schema import load_schema
@@ -97,7 +98,7 @@ def generate_test_event_data_for_data_type(data_type):  # pragma: no cover
     defaults_per_type = {
         int: 1,
         bool: True,
-        str: "default",
+        str: "passing",
         float: 1.0,
         CourseKey: CourseKey.from_string("course-v1:edX+DemoX.1+2014"),
         UsageKey: UsageKey.from_string(
@@ -107,6 +108,7 @@ def generate_test_event_data_for_data_type(data_type):  # pragma: no cover
         LibraryUsageLocatorV2: LibraryUsageLocatorV2.from_string('lb:MITx:reallyhardproblems:problem:problem1'),
         List[int]: [1, 2, 3],
         datetime: datetime.now(),
+        CCXLocator: CCXLocator(org='edx', course='DemoX', run='Demo_course', ccx='1'),
     }
     data_dict = {}
     for attribute in data_type.__attrs_attrs__:
diff --git a/openedx_events/learning/data.py b/openedx_events/learning/data.py
index 9595dbf12..901dbffba 100644
--- a/openedx_events/learning/data.py
+++ b/openedx_events/learning/data.py
@@ -88,7 +88,8 @@ class CcxCourseData:
         coach_email (str): The email address of the coach (instructor) for the CCX course.
         start (str, optional): The start date of the CCX course. Defaults to None, indicating no specific start date.
         end (str, optional): The end date of the CCX course. Defaults to None, indicating no specific end date.
-        max_students_allowed (int, optional): The maximum number of students that can enroll in the CCX course. Defaults to None, indicating no limit.
+        max_students_allowed (int, optional): The maximum number of students that can enroll in the CCX course.
+        Defaults to None, indicating no limit.
     """
 
     ccx_course_key = attr.ib(type=CCXLocator)
@@ -510,10 +511,13 @@ class CoursePassingStatusData:
     Represents the event data when a user's grade is updated, indicates if current grade is enough for course passing.
 
     Attributes:
-        status (str): A string containing information about user's current course grade value in comparison to the grading policy threshold.
+        status (str): A string containing information about user's current course grade value
+        in comparison to the grading policy threshold.
         user (UserData): An instance of UserData containing information about the user whose grade was updated.
-        course (CourseData): An instance of CourseData containing details about the course in which the grade was updated.
+        course (CourseData): An instance of CourseData containing details about the course
+        in which the grade was updated.
     """
+
     PASSING = 'passing'
     FAILING = 'failing'
     STATUSES = [PASSING, FAILING]
@@ -532,9 +536,11 @@ class CcxCoursePassingStatusData(CoursePassingStatusData):
     providing a custom course attribute suited for CCX course instances.
 
     Attributes:
-        course (CcxCourseData): An instance of CcxCourseData containing details about the CCX course in which the grade threshold was crossed.
+        course (CcxCourseData): An instance of CcxCourseData containing details about the CCX course
+        in which the grade threshold was crossed.
         All other attributes are inherited from CoursePassingStatusData.
     """
+
     course = attr.ib(type=CcxCourseData)
 
 
diff --git a/openedx_events/learning/signals.py b/openedx_events/learning/signals.py
index dc5633755..d39700667 100644
--- a/openedx_events/learning/signals.py
+++ b/openedx_events/learning/signals.py
@@ -16,8 +16,8 @@
     CourseAccessRoleData,
     CourseDiscussionConfigurationData,
     CourseEnrollmentData,
-    CoursePassingStatusData,
     CourseNotificationData,
+    CoursePassingStatusData,
     DiscussionThreadData,
     ExamAttemptData,
     ORASubmissionData,
@@ -400,4 +400,4 @@
     data={
         "badge": BadgeData,
     }
-)
\ No newline at end of file
+)