diff --git a/polemarch/__init__.py b/polemarch/__init__.py index 2455f358..f9eee9d0 100644 --- a/polemarch/__init__.py +++ b/polemarch/__init__.py @@ -31,6 +31,6 @@ "VST_ROOT_URLCONF": os.getenv("VST_ROOT_URLCONF", 'vstutils.urls'), } -__version__ = "1.8.1" +__version__ = "1.8.2" prepare_environment(**default_settings) diff --git a/polemarch/main/hooks/http.py b/polemarch/main/hooks/http.py index cd12f339..282c13cc 100644 --- a/polemarch/main/hooks/http.py +++ b/polemarch/main/hooks/http.py @@ -11,7 +11,7 @@ class Backend(BaseHook): def execute(self, url, when, message) -> str: data = dict(type=when, payload=message) try: - response = requests.post(url, data=data) + response = requests.post(url, json=data) return "{} {}: {}".format( response.status_code, response.reason, response.text ) diff --git a/polemarch/main/unittests/hooks.py b/polemarch/main/unittests/hooks.py index 2e08d51f..e1aee9bd 100644 --- a/polemarch/main/unittests/hooks.py +++ b/polemarch/main/unittests/hooks.py @@ -1,5 +1,5 @@ import os -import json +import json as json_mod try: from mock import patch except ImportError: # nocv @@ -34,7 +34,7 @@ def check_output_run(self, check_data, *args, **kwargs): rep += self.recipients[self.count] self.assertEqual(check_data[0], rep) self.assertEqual(check_data[1], 'on_execution') - message = json.loads(kwargs['input']) + message = json_mod.loads(kwargs['input']) self.assertEqual(message.get('test', None), 'test') self.assertTrue(kwargs['universal_newlines']) self.count += 1 @@ -64,12 +64,12 @@ def test_script(self): self.assertEqual(hook.run(message=dict(test="test")), "Err\nErr") self.assertEqual(cmd.call_count, 4) - def check_output_run_http(self, method, url, data, **kwargs): + def check_output_run_http(self, method, url, data=None, json=None, **kwargs): # pylint: disable=protected-access, unused-argument self.assertEqual(method, "post") self.check_output_run( - [url, data['type']], - cwd='', input=json.dumps(data['payload']), + [url, json['type']], + cwd='', input=json_mod.dumps(json['payload']), universal_newlines=True ) the_response = Response() diff --git a/requirements-test.txt b/requirements-test.txt index cc0c462b..788fbf55 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,6 +1,6 @@ -vcrpy-unittest==0.1.6 -coverage~=5.1 +vcrpy-unittest==0.1.7 +coverage~=5.5 mock~=3.0.5 -fakeldap==0.6.1 -tblib~=1.6.0 -django-test-migrations~=1.0.0 +fakeldap==0.6.2 +tblib~=1.7.0 +django-test-migrations~=1.1.0 diff --git a/requirements.txt b/requirements.txt index 7697b4b5..97a7aaec 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,14 +1,14 @@ # Main vstutils[rpc,ldap,doc,prod]~=4.0.14 docutils~=0.16.0 -markdown2==2.3.9 +markdown2~=2.4.0 # Repo types -gitpython==3.1.0 -gitdb2==3.0.3 +gitpython~=3.1.14 +gitdb2~=4.0.2 # Hooks -requests==2.22.0 +requests~=2.25.1 # Ansible required packages polemarch-ansible~=2.1.0 diff --git a/selenium_tests.py b/selenium_tests.py deleted file mode 100644 index 7e10b47c..00000000 --- a/selenium_tests.py +++ /dev/null @@ -1,65 +0,0 @@ -from time import sleep -from django.test import LiveServerTestCase, override_settings -from django.contrib.auth import get_user_model -from selenium import webdriver -from selenium.webdriver.common.keys import Keys -from selenium.common import exceptions - - -class SeleniumTestCase(LiveServerTestCase): - host = 'localhost' - port = 8888 - - def setUp(self): - options = webdriver.ChromeOptions() - options.add_argument("--headless") - options.add_argument("--no-sandbox") - # options.add_argument("--disable-dev-shm-usage") - options.add_argument("--disable-gpu") - options.add_argument("--auto-open-devtools-for-tabs") - self.selenium = webdriver.Chrome(options=options) - self.selenium.set_window_size(1280, 3240) - super(SeleniumTestCase, self).setUp() - - def tearDown(self): - self.selenium.save_screenshot('test_screenshot.png') - self.selenium.quit() - super(SeleniumTestCase, self).tearDown() - - @override_settings(DEBUG=True) - def test_qunit(self): - selenium = self.selenium - # Opening the link we want to test - selenium.get('http://localhost:8888/') - login = selenium.find_element_by_name('username') - login.send_keys('admin') - password = selenium.find_element_by_name('password') - password.send_keys('admin') - submit = selenium.find_element_by_id('login_button') - submit.send_keys(Keys.RETURN) - trys = 40 - for i in range(trys): - try: - selenium.execute_script('window.loadQUnitTests()') - trys = 300 - break - except exceptions.WebDriverException: - log_data = selenium.get_log('browser') - if log_data: - print(log_data) - sleep(1) - trys -= 1 - finally: - self.assertTrue(trys > 0, trys) - saveReportObj = None - for _ in range(900): - try: - saveReportObj = selenium.find_element_by_id('qunit-saveReport') - except exceptions.NoSuchElementException: - log_data = selenium.get_log('browser') - if log_data: - print(log_data) - sleep(1) - else: - break - self.assertNotEqual(saveReportObj, None) diff --git a/setup.py b/setup.py index b77f07e1..a9d78f70 100644 --- a/setup.py +++ b/setup.py @@ -346,11 +346,11 @@ def get_compile_command(extensions_dict=None): def make_setup(**opts): if 'packages' not in opts: opts['packages'] = find_packages() - ext_modules_list = opts.pop('ext_modules_list', list()) + ext_modules_list = opts.pop('ext_modules_list', []) ext_mod, ext_mod_dict = make_extensions(ext_modules_list, opts['packages']) - opts['ext_modules'] = opts.get('ext_modules', list()) + ext_mod + opts['ext_modules'] = opts.get('ext_modules', []) + ext_mod cmdclass = opts.get('cmdclass', dict()) - static_exclude = opts.pop('static_exclude_min', list()) + static_exclude = opts.pop('static_exclude_min', []) if 'compile' not in cmdclass: compile_class = get_compile_command(ext_mod_dict) compile_class.static_exclude = static_exclude @@ -358,7 +358,7 @@ def make_setup(**opts): if has_cython: build_py.exclude = ext_modules_list install_lib.static_exclude = static_exclude - install_lib.compile_exclude = opts.pop('compile_modules_exclude', list()) + install_lib.compile_exclude = opts.pop('compile_modules_exclude', []) cmdclass.update({ 'build_ext': _build_ext, 'build_py': build_py, diff --git a/tox.ini b/tox.ini index b6672495..e34dbdc3 100644 --- a/tox.ini +++ b/tox.ini @@ -41,7 +41,7 @@ deps = -rrequirements-test.txt [testenv:flake] -basepython = python3.6 +basepython = python3.8 deps = flake8 -rrequirements.txt @@ -50,7 +50,7 @@ commands = flake8 --config=.pep8 polemarch [testenv:pylint] -basepython = python3.6 +basepython = python3.8 deps = pylint==2.3.0 pylint-django==2.0.6 @@ -63,24 +63,6 @@ commands = pip install -U -e . pylint --rcfile=./.pylintrc {posargs} polemarch -[testenv:selenium] -basepython = python3.6 -passenv = DJANGO_LOG_LEVEL -changedir = ./ -commands = - coverage debug sys - coverage erase - coverage run -m polemarch test -v 2 --failfast --noinput selenium_tests - coverage combine - coverage report -deps = - cython>=0.28,<0.30 - selenium==3.14.1 - -e . - -rrequirements-doc.txt - -rrequirements-git.txt - -rrequirements-test.txt - [testenv:build] basepython = python3.6 passenv = *