Skip to content

Commit

Permalink
fix: remove unused function to test integration
Browse files Browse the repository at this point in the history
  • Loading branch information
luisfelipec95 committed May 8, 2024
1 parent 863b941 commit c3e97ad
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 42 deletions.
2 changes: 1 addition & 1 deletion eox_hooks/edxapp_wrapper/backends/course_modes_j_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Backend file for Course Modes related objects.
"""
from course_modes.models import CourseMode # pylint: disable=C0415, E0401


def get_all_course_modes():
Expand All @@ -10,6 +11,5 @@ def get_all_course_modes():
Returns:
[list]: list of course modes.
"""
from course_modes.models import CourseMode # pylint: disable=C0415, E0401
modes_for_course = CourseMode.ALL_MODES
return modes_for_course
2 changes: 1 addition & 1 deletion eox_hooks/edxapp_wrapper/backends/course_modes_l_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Backend file for Course Modes related objects.
"""
from common.djangoapps.course_modes.models import CourseMode # pylint: disable=C0415, E0401


def get_all_course_modes():
Expand All @@ -10,6 +11,5 @@ def get_all_course_modes():
Returns:
[list]: list of course modes.
"""
from common.djangoapps.course_modes.models import CourseMode # pylint: disable=C0415, E0401
modes_for_course = CourseMode.ALL_MODES
return modes_for_course
2 changes: 1 addition & 1 deletion eox_hooks/edxapp_wrapper/backends/courses_j_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""
Backend file for Course related objects.
"""
from courseware.module_render import load_single_xblock # pylint: disable=C0415, E0401


def get_load_single_xblock():
Expand All @@ -10,7 +11,6 @@ def get_load_single_xblock():
Returns:
[Function]: load_single_xblock function.
"""
from courseware.module_render import load_single_xblock # pylint: disable=C0415, E0401
return load_single_xblock


Expand Down
4 changes: 2 additions & 2 deletions eox_hooks/edxapp_wrapper/backends/courses_l_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Backend file for Course related objects.
"""
from lms.djangoapps.courseware.module_render import load_single_xblock # pylint: disable=C0415, E0401
from xmodule.modulestore.exceptions import ItemNotFoundError # pylint: disable=C0415, E0401


def get_load_single_xblock():
Expand All @@ -10,7 +12,6 @@ def get_load_single_xblock():
Returns:
[Function]: load_single_xblock function.
"""
from lms.djangoapps.courseware.module_render import load_single_xblock # pylint: disable=C0415, E0401
return load_single_xblock


Expand All @@ -21,5 +22,4 @@ def get_item_not_found_exception():
Returns:
[Class]: ItemNotFoundError exception.
"""
from xmodule.modulestore.exceptions import ItemNotFoundError # pylint: disable=C0415, E0401
return ItemNotFoundError
5 changes: 3 additions & 2 deletions eox_hooks/edxapp_wrapper/backends/courses_p_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
"""
Backend file for Course related objects.
"""
from lms.djangoapps.courseware.block_render import load_single_xblock # pylint: disable=C0415, E0401
from xmodule.modulestore.exceptions import ItemNotFoundError # pylint: disable=C0415, E0401



def get_load_single_xblock():
Expand All @@ -10,7 +13,6 @@ def get_load_single_xblock():
Returns:
[Function]: load_single_xblock function.
"""
from lms.djangoapps.courseware.block_render import load_single_xblock # pylint: disable=C0415, E0401
return load_single_xblock


Expand All @@ -21,5 +23,4 @@ def get_item_not_found_exception():
Returns:
[Class]: ItemNotFoundError exception.
"""
from xmodule.modulestore.exceptions import ItemNotFoundError # pylint: disable=C0415, E0401
return ItemNotFoundError
3 changes: 2 additions & 1 deletion eox_hooks/edxapp_wrapper/backends/enrollments_j_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Backend file for Course Enrollment related objects.
"""
from student.models import CourseEnrollment # pylint: disable=C0415, E0401



def get_course_enrollment():
Expand All @@ -10,5 +12,4 @@ def get_course_enrollment():
Returns:
[Class]: Course Enrollment edxapp model.
"""
from student.models import CourseEnrollment # pylint: disable=C0415, E0401
return CourseEnrollment
3 changes: 2 additions & 1 deletion eox_hooks/edxapp_wrapper/backends/enrollments_l_v1.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
"""
Backend file for Course Enrollment related objects.
"""
from common.djangoapps.student.models import CourseEnrollment # pylint: disable=C0415, E0401



def get_course_enrollment():
Expand All @@ -10,5 +12,4 @@ def get_course_enrollment():
Returns:
[Class]: Course Enrollment edxapp model.
"""
from common.djangoapps.student.models import CourseEnrollment # pylint: disable=C0415, E0401
return CourseEnrollment
4 changes: 2 additions & 2 deletions eox_hooks/edxapp_wrapper/backends/models_j_v1.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Simple backend that returns the platform's models
"""
from lms.djangoapps.certificates.models import GeneratedCertificate # pylint: disable=C0415, E0401
from student.models import UserProfile # pylint: disable=C0415, E0401


def get_certificate_model():
"""Return the GeneratedCertificate model class when called during runtime"""
from lms.djangoapps.certificates.models import GeneratedCertificate # pylint: disable=C0415, E0401
return GeneratedCertificate


def get_user_profile_model():
"""Return the UserProfile model class when called during runtime"""
from student.models import UserProfile # pylint: disable=C0415, E0401
return UserProfile
4 changes: 2 additions & 2 deletions eox_hooks/edxapp_wrapper/backends/models_l_v1.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"""
Simple backend that returns the platform's models
"""
from lms.djangoapps.certificates.models import GeneratedCertificate # pylint: disable=C0415, E0401
from common.djangoapps.student.models import UserProfile # pylint: disable=C0415, E0401


def get_certificate_model():
"""Return the GeneratedCertificate model class when called during runtime"""
from lms.djangoapps.certificates.models import GeneratedCertificate # pylint: disable=C0415, E0401
return GeneratedCertificate


def get_user_profile_model():
"""Return the UserProfile model class when called during runtime"""
from common.djangoapps.student.models import UserProfile # pylint: disable=C0415, E0401
return UserProfile
30 changes: 1 addition & 29 deletions eox_hooks/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,53 +5,25 @@

from django.test import TestCase

from eox_hooks.actions import post_to_webhook_url


class TutorIntegrationTestCase(TestCase):
"""
POC code to run tests that cover the integration with openedx
Tests integration with openedx
"""

def test_runs_code(self):
"""
Just to make sure our test infrastructure is behaving
"""
assert True

# pylint: disable=import-outside-toplevel,unused-import
def test_current_settings_code_imports(self):
"""
Running this imports means that our backends import the right signature
"""
import eox_hooks.edxapp_wrapper.backends.course_modes_j_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.course_modes_l_v1_test # isort:skip
import eox_hooks.edxapp_wrapper.backends.course_modes_l_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.courses_j_v1_test # isort:skip
import eox_hooks.edxapp_wrapper.backends.courses_j_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.courses_l_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.courses_p_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.enrollments_l_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.enrollments_l_v1_test # isort:skip
import eox_hooks.edxapp_wrapper.backends.enrollments_j_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.models_j_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.models_l_v1 # isort:skip
import eox_hooks.edxapp_wrapper.backends.models_l_v1_test # isort:skip


class TestPostToWebhook(TestCase):
"""
Test eox-hooks functions
"""
@patch('eox_hooks.actions.requests.post')
def test_post_to_webhook_url(self, mock_post):
"""
Test function post_to_webhook_url
"""
mock_trigger_event = "trigger_event"

mock_post.return_value = MagicMock(status_code=200)

result = post_to_webhook_url(trigger_event=mock_trigger_event)

self.assertTrue(result)

0 comments on commit c3e97ad

Please sign in to comment.