Skip to content

Commit

Permalink
1.8.2
Browse files Browse the repository at this point in the history
Changelog:
*  Fix: update libs to latest stable versions. 
*  Fix: Hooks post data in json (vstconsulting/polemarch#115).

See merge request polemarch/ce!215
  • Loading branch information
onegreyonewhite committed Mar 5, 2021
2 parents 7ff83d6 + 5ea0295 commit 0f708ac
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 105 deletions.
2 changes: 1 addition & 1 deletion polemarch/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion polemarch/main/hooks/http.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
Expand Down
10 changes: 5 additions & 5 deletions polemarch/main/unittests/hooks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import os
import json
import json as json_mod
try:
from mock import patch
except ImportError: # nocv
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
10 changes: 5 additions & 5 deletions requirements-test.txt
Original file line number Diff line number Diff line change
@@ -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
8 changes: 4 additions & 4 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down
65 changes: 0 additions & 65 deletions selenium_tests.py

This file was deleted.

8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -346,19 +346,19 @@ 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
cmdclass.update({"compile": get_compile_command(ext_mod_dict)})
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,
Expand Down
22 changes: 2 additions & 20 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ deps =
-rrequirements-test.txt

[testenv:flake]
basepython = python3.6
basepython = python3.8
deps =
flake8
-rrequirements.txt
Expand All @@ -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
Expand All @@ -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 = *
Expand Down

0 comments on commit 0f708ac

Please sign in to comment.