Skip to content

Commit

Permalink
feat: add integration test (#204)
Browse files Browse the repository at this point in the history
  • Loading branch information
luisfelipec95 authored May 24, 2024
1 parent 71737f2 commit df86b60
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 0 deletions.
10 changes: 10 additions & 0 deletions eox_tenant/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
"""
from __future__ import absolute_import, unicode_literals

import codecs
import os

import yaml

from .common import * # pylint: disable=wildcard-import,unused-wildcard-import


Expand Down Expand Up @@ -90,3 +95,8 @@ def plugin_settings(settings): # pylint: disable=function-redefined
settings.OAUTH2_PROVIDER['OAUTH2_VALIDATOR_CLASS'] = (
'openedx.core.djangoapps.oauth_dispatch.dot_overrides.validators.EdxOAuth2Validator'
)

# setup the databases used in the tutor local environment
with codecs.open(os.environ['LMS_CFG'], encoding='utf-8') as f:
env_tokens = yaml.safe_load(f)
settings.DATABASES = env_tokens['DATABASES']
Empty file.
16 changes: 16 additions & 0 deletions eox_tenant/test/tutor/tutor/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"""
The conftest module sets up the database connection for pytest-django.
The integration tests will reuse the database from tutor local so a noop
django_db_setup is required.
See: https://pytest-django.readthedocs.io/en/latest/database.html
"""

import pytest # pylint: disable=import-error


@pytest.fixture(scope='session')
def django_db_setup():
"""
Makes the tests reuse the existing database
"""
23 changes: 23 additions & 0 deletions eox_tenant/test/tutor/tutor/integration_test_tutor.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"""
Test integration file.
"""
from django.test import TestCase


class TutorIntegrationTestCase(TestCase):
"""
Tests integration with openedx
"""

# 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_tenant.edxapp_wrapper.backends.oauth_dispatch_j_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.branding_api_l_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.site_configuration_module_i_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.theming_helpers_h_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.users_l_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.bearer_authentication_l_v1 # isort:skip
import eox_tenant.edxapp_wrapper.backends.edxmako_l_v1 # isort:skip
7 changes: 7 additions & 0 deletions eox_tenant/test/tutor/tutor/pytest.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[pytest]
python_files = integration_test_*.py
filterwarnings =
default
# We ignore every warning while we actually get the testing infrastructure
# running for different version of tutor in gh actions
ignore:
1 change: 1 addition & 0 deletions requirements/test.in
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ coverage
mock
testfixtures
path.py
pyyaml
2 changes: 2 additions & 0 deletions requirements/test.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ pymongo==3.13.0
# via
# -r requirements/base.txt
# edx-opaque-keys
pyyaml==6.0.1
# via -r requirements/test.in
python3-openid==3.2.0
# via
# -r requirements/base.txt
Expand Down

0 comments on commit df86b60

Please sign in to comment.