chore: remove bok choy settings

This commit is contained in:
salman2013
2023-09-27 10:58:37 +05:00
parent 8c9232ace9
commit 42ca0ddec4
33 changed files with 28 additions and 2500 deletions

View File

@@ -1,30 +0,0 @@
"""
Django management command to update the loaded test fixtures as necessary for
the current test environment. Currently just sets an appropriate domain for
each Site fixture.
"""
import os
from django.contrib.sites.models import Site
from django.core.management.base import BaseCommand
class Command(BaseCommand):
"""
update_fixtures management command
"""
help = "Update fixtures to match the current test environment."
def handle(self, *args, **options):
if 'BOK_CHOY_HOSTNAME' in os.environ:
# Fix the Site fixture domains so third party auth tests work correctly
host = os.environ['BOK_CHOY_HOSTNAME']
cms_port = os.environ['BOK_CHOY_CMS_PORT']
lms_port = os.environ['BOK_CHOY_LMS_PORT']
cms_domain = f'{host}:{cms_port}'
Site.objects.filter(name='cms').update(domain=cms_domain)
lms_domain = f'{host}:{lms_port}'
Site.objects.filter(name='lms').update(domain=lms_domain)

View File

@@ -1,42 +0,0 @@
""" # lint-amnesty, pylint: disable=django-not-configured
Tests of the update_fixtures management command for bok-choy test database
initialization.
"""
import os
import pytest
from django.contrib.sites.models import Site
from django.core.management import call_command
@pytest.fixture(scope='function')
def sites(db): # lint-amnesty, pylint: disable=unused-argument
Site.objects.create(name='cms', domain='localhost:8031')
Site.objects.create(name='lms', domain='localhost:8003')
def test_localhost(db, monkeypatch, sites): # lint-amnesty, pylint: disable=redefined-outer-name, unused-argument
monkeypatch.delitem(os.environ, 'BOK_CHOY_HOSTNAME', raising=False)
call_command('update_fixtures')
assert Site.objects.get(name='cms').domain == 'localhost:8031'
assert Site.objects.get(name='lms').domain == 'localhost:8003'
def test_devstack_cms(db, monkeypatch, sites): # lint-amnesty, pylint: disable=redefined-outer-name, unused-argument
monkeypatch.setitem(os.environ, 'BOK_CHOY_HOSTNAME', 'edx.devstack.cms')
monkeypatch.setitem(os.environ, 'BOK_CHOY_CMS_PORT', '18031')
monkeypatch.setitem(os.environ, 'BOK_CHOY_LMS_PORT', '18003')
call_command('update_fixtures')
assert Site.objects.get(name='cms').domain == 'edx.devstack.cms:18031'
assert Site.objects.get(name='lms').domain == 'edx.devstack.cms:18003'
def test_devstack_lms(db, monkeypatch, sites): # lint-amnesty, pylint: disable=redefined-outer-name, unused-argument
monkeypatch.setitem(os.environ, 'BOK_CHOY_HOSTNAME', 'edx.devstack.lms')
monkeypatch.setitem(os.environ, 'BOK_CHOY_CMS_PORT', '18031')
monkeypatch.setitem(os.environ, 'BOK_CHOY_LMS_PORT', '18003')
call_command('update_fixtures')
assert Site.objects.get(name='cms').domain == 'edx.devstack.lms:18031'
assert Site.objects.get(name='lms').domain == 'edx.devstack.lms:18003'

View File

@@ -228,8 +228,7 @@ class TestProblemTypeAccess(SharedModuleStoreTestCase, MasqueradeMixin): # pyli
graded=False,
)
cls.graded_score_weight_blocks[(graded, has_score, weight)] = block
host = os.environ.get('BOK_CHOY_HOSTNAME', '127.0.0.1')
host = os.environ.get('127.0.0.1')
metadata_lti_xblock = {
'lti_id': 'correct_lti_id',
'launch_url': 'http://{}:{}/{}'.format(host, '8765', 'correct_lti_endpoint'),

View File

@@ -3,9 +3,9 @@ A pytest plugin that reports test contexts to coverage running in another proces
"""
import pytest
import requests
# import requests
from pavelib.utils.envs import Env
# from pavelib.utils.envs import Env
class RemoteContextPlugin:
@@ -25,16 +25,17 @@ class RemoteContextPlugin:
def pytest_runtest_call(self, item):
self.doit(item, "call")
def doit(self, item, when): # lint-amnesty, pylint: disable=missing-function-docstring
if self.active:
for cfg in Env.BOK_CHOY_SERVERS.values():
result = requests.post(
'http://{host}:{port}/coverage_context/update_context'.format(**cfg),
{
'context': f"{item.nodeid}|{when}",
}
)
assert result.status_code == 204
# commented for testing
# def doit(self, item, when): # lint-amnesty, pylint: disable=missing-function-docstring
# if self.active:
# for cfg in Env.BOK_CHOY_SERVERS.values():
# result = requests.post(
# 'http://{host}:{port}/coverage_context/update_context'.format(**cfg),
# {
# 'context': f"{item.nodeid}|{when}",
# }
# )
# assert result.status_code == 204
@pytest.hookimpl(tryfirst=True)