Skip to content

Commit

Permalink
fix: addressing quality alerts
Browse files Browse the repository at this point in the history
  • Loading branch information
felipemontoya committed Mar 8, 2024
1 parent 3270b7c commit 07585d8
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 20 deletions.
17 changes: 5 additions & 12 deletions eox_tenant/settings/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"""
from __future__ import absolute_import, unicode_literals

import os
import codecs
import yaml
import os

import yaml

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

Expand All @@ -15,13 +15,6 @@ class SettingsClass:
""" dummy settings class """
OAUTH2_PROVIDER = {}

def get_env_setting(setting):
""" Get the environment setting or return exception """
try:
return os.environ[setting]
except KeyError:
error_msg = "Set the %s env variable" % setting
raise ImproperlyConfigured(error_msg) # lint-amnesty, pylint: disable=raise-missing-from

ALLOWED_HOSTS = ['*']
SETTINGS = SettingsClass()
Expand Down Expand Up @@ -104,6 +97,6 @@ def plugin_settings(settings): # pylint: disable=function-redefined
)

# setup the databases used in the tutor local environment
with codecs.open(get_env_setting('LMS_CFG'), encoding='utf-8') as f:
ENV_TOKENS = yaml.safe_load(f)
settings.DATABASES = ENV_TOKENS['DATABASES']
with codecs.open(os.environ['LMS_CFG'], encoding='utf-8') as f:
env_tokens = yaml.safe_load(f)
settings.DATABASES = env_tokens['DATABASES']
3 changes: 1 addition & 2 deletions eox_tenant/tenant_aware_functions/enrollments.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ def filter_enrollments(enrollments):
# If test setting is true, returns the same enrollments,
# or if we do not have a microsite context, there is nothing we can do.
if test_skip or not theming_helpers.is_request_in_themed_site():
for enrollment in enrollments:
yield enrollment
yield from enrollments
return

configuration_helpers = get_configuration_helpers()
Expand Down
11 changes: 9 additions & 2 deletions eox_tenant/test/tutor/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
import pytest
"""
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
"""
pass
10 changes: 6 additions & 4 deletions eox_tenant/test/tutor/integration_test_tutor.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
Test views file.
"""
from django.test import TestCase
from django.urls import reverse
from django.conf import settings


class TutorIntegrationTestCase(TestCase):
Expand All @@ -17,17 +15,21 @@ def test_runs_code(self):
"""
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_tenant.edxapp_wrapper.backends.oauth_dispatch_j_v1
import eox_tenant.edxapp_wrapper.backends.branding_api_l_v1
# import eox_tenant.edxapp_wrapper.backends.certificates_module_i_v1 # fixme
# fixme: needs to be properly removed if unused at the latest version # pylint: disable=fixme
# import eox_tenant.edxapp_wrapper.backends.certificates_module_i_v1
import eox_tenant.edxapp_wrapper.backends.site_configuration_module_i_v1
import eox_tenant.edxapp_wrapper.backends.theming_helpers_h_v1
# import eox_tenant.edxapp_wrapper.backends.edx_auth_i_v1 # fixme
# fixme: needs to be properly removed if unused at the latest version # pylint: disable=fixme
# import eox_tenant.edxapp_wrapper.backends.edx_auth_i_v1
import eox_tenant.edxapp_wrapper.backends.users_l_v1
import eox_tenant.edxapp_wrapper.backends.bearer_authentication_l_v1
import eox_tenant.edxapp_wrapper.backends.edxmako_l_v1
# fixme: needs to be properly removed if unused at the latest version # pylint: disable=fixme
# import eox_tenant.edxapp_wrapper.backends.util_h_v1 # fixme

0 comments on commit 07585d8

Please sign in to comment.