diff --git a/platform_plugin_aspects/signals.py b/platform_plugin_aspects/signals.py index 182358b..26bad3f 100644 --- a/platform_plugin_aspects/signals.py +++ b/platform_plugin_aspects/signals.py @@ -39,7 +39,7 @@ def receive_course_enrollment_changed( # pylint: disable=unused-argument # pra sender, **kwargs ): """ - Receives ENROLL_STATUS_CHANGE + Receives ENROLL_STATUS_CHANGE signal and queues the dump job. """ from platform_plugin_aspects.tasks import ( # pylint: disable=import-outside-toplevel dump_data_to_clickhouse, diff --git a/platform_plugin_aspects/sinks/base_sink.py b/platform_plugin_aspects/sinks/base_sink.py index 38008f0..7e80ea2 100644 --- a/platform_plugin_aspects/sinks/base_sink.py +++ b/platform_plugin_aspects/sinks/base_sink.py @@ -271,7 +271,7 @@ def send_item(self, serialized_item, many=False): writer.writerow(node.values()) else: writer.writerow(serialized_item.values()) - print("ClickHouse CSV output", output.getvalue().encode("utf-8")) + request = requests.Request( "POST", self.ch_url, diff --git a/platform_plugin_aspects/sinks/tests/test_course_enrollment_sink.py b/platform_plugin_aspects/sinks/tests/test_course_enrollment_sink.py new file mode 100644 index 0000000..513186f --- /dev/null +++ b/platform_plugin_aspects/sinks/tests/test_course_enrollment_sink.py @@ -0,0 +1,20 @@ +""" +Test the course enrollment sink module. +""" + +from unittest.mock import patch + +from platform_plugin_aspects.sinks import CourseEnrollmentSink + + +@patch("platform_plugin_aspects.sinks.ModelBaseSink.get_queryset") +def test_get_queryset(mock_get_queryset): + """ + Test the get_queryset method. + """ + sink = CourseEnrollmentSink(None, None) + + sink.get_queryset() + + mock_get_queryset.assert_called_once_with(None) + mock_get_queryset.return_value.select_related.assert_called_once_with("user") diff --git a/platform_plugin_aspects/sinks/tests/test_external_id_sink.py b/platform_plugin_aspects/sinks/tests/test_external_id_sink.py index 6ee1b83..4a516a9 100644 --- a/platform_plugin_aspects/sinks/tests/test_external_id_sink.py +++ b/platform_plugin_aspects/sinks/tests/test_external_id_sink.py @@ -17,6 +17,4 @@ def test_get_queryset(mock_get_queryset): sink.get_queryset() mock_get_queryset.assert_called_once_with(None) - mock_get_queryset.return_value.select_related.assert_called_once_with( - "user", "external_id_type" - ) + mock_get_queryset.return_value.select_related.assert_called_once_with("user")