Skip to content

Commit 5ea0295

Browse files
Fix: update libs and http hooks post data.
vstconsulting/polemarch#115
1 parent 27af75d commit 5ea0295

File tree

8 files changed

+22
-105
lines changed

8 files changed

+22
-105
lines changed

polemarch/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
"VST_ROOT_URLCONF": os.getenv("VST_ROOT_URLCONF", 'vstutils.urls'),
3232
}
3333

34-
__version__ = "1.8.1"
34+
__version__ = "1.8.2"
3535

3636
prepare_environment(**default_settings)

polemarch/main/hooks/http.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ class Backend(BaseHook):
1111
def execute(self, url, when, message) -> str:
1212
data = dict(type=when, payload=message)
1313
try:
14-
response = requests.post(url, data=data)
14+
response = requests.post(url, json=data)
1515
return "{} {}: {}".format(
1616
response.status_code, response.reason, response.text
1717
)

polemarch/main/unittests/hooks.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import os
2-
import json
2+
import json as json_mod
33
try:
44
from mock import patch
55
except ImportError: # nocv
@@ -34,7 +34,7 @@ def check_output_run(self, check_data, *args, **kwargs):
3434
rep += self.recipients[self.count]
3535
self.assertEqual(check_data[0], rep)
3636
self.assertEqual(check_data[1], 'on_execution')
37-
message = json.loads(kwargs['input'])
37+
message = json_mod.loads(kwargs['input'])
3838
self.assertEqual(message.get('test', None), 'test')
3939
self.assertTrue(kwargs['universal_newlines'])
4040
self.count += 1
@@ -64,12 +64,12 @@ def test_script(self):
6464
self.assertEqual(hook.run(message=dict(test="test")), "Err\nErr")
6565
self.assertEqual(cmd.call_count, 4)
6666

67-
def check_output_run_http(self, method, url, data, **kwargs):
67+
def check_output_run_http(self, method, url, data=None, json=None, **kwargs):
6868
# pylint: disable=protected-access, unused-argument
6969
self.assertEqual(method, "post")
7070
self.check_output_run(
71-
[url, data['type']],
72-
cwd='', input=json.dumps(data['payload']),
71+
[url, json['type']],
72+
cwd='', input=json_mod.dumps(json['payload']),
7373
universal_newlines=True
7474
)
7575
the_response = Response()

requirements-test.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
vcrpy-unittest==0.1.6
2-
coverage~=5.1
1+
vcrpy-unittest==0.1.7
2+
coverage~=5.5
33
mock~=3.0.5
4-
fakeldap==0.6.1
5-
tblib~=1.6.0
6-
django-test-migrations~=1.0.0
4+
fakeldap==0.6.2
5+
tblib~=1.7.0
6+
django-test-migrations~=1.1.0

requirements.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
# Main
22
vstutils[rpc,ldap,doc,prod]~=4.0.14
33
docutils~=0.16.0
4-
markdown2==2.3.9
4+
markdown2~=2.4.0
55

66
# Repo types
7-
gitpython==3.1.0
8-
gitdb2==3.0.3
7+
gitpython~=3.1.14
8+
gitdb2~=4.0.2
99

1010
# Hooks
11-
requests==2.22.0
11+
requests~=2.25.1
1212

1313
# Ansible required packages
1414
polemarch-ansible~=2.1.0

selenium_tests.py

Lines changed: 0 additions & 65 deletions
This file was deleted.

setup.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -346,19 +346,19 @@ def get_compile_command(extensions_dict=None):
346346
def make_setup(**opts):
347347
if 'packages' not in opts:
348348
opts['packages'] = find_packages()
349-
ext_modules_list = opts.pop('ext_modules_list', list())
349+
ext_modules_list = opts.pop('ext_modules_list', [])
350350
ext_mod, ext_mod_dict = make_extensions(ext_modules_list, opts['packages'])
351-
opts['ext_modules'] = opts.get('ext_modules', list()) + ext_mod
351+
opts['ext_modules'] = opts.get('ext_modules', []) + ext_mod
352352
cmdclass = opts.get('cmdclass', dict())
353-
static_exclude = opts.pop('static_exclude_min', list())
353+
static_exclude = opts.pop('static_exclude_min', [])
354354
if 'compile' not in cmdclass:
355355
compile_class = get_compile_command(ext_mod_dict)
356356
compile_class.static_exclude = static_exclude
357357
cmdclass.update({"compile": get_compile_command(ext_mod_dict)})
358358
if has_cython:
359359
build_py.exclude = ext_modules_list
360360
install_lib.static_exclude = static_exclude
361-
install_lib.compile_exclude = opts.pop('compile_modules_exclude', list())
361+
install_lib.compile_exclude = opts.pop('compile_modules_exclude', [])
362362
cmdclass.update({
363363
'build_ext': _build_ext,
364364
'build_py': build_py,

tox.ini

Lines changed: 2 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ deps =
4141
-rrequirements-test.txt
4242

4343
[testenv:flake]
44-
basepython = python3.6
44+
basepython = python3.8
4545
deps =
4646
flake8
4747
-rrequirements.txt
@@ -50,7 +50,7 @@ commands =
5050
flake8 --config=.pep8 polemarch
5151

5252
[testenv:pylint]
53-
basepython = python3.6
53+
basepython = python3.8
5454
deps =
5555
pylint==2.3.0
5656
pylint-django==2.0.6
@@ -63,24 +63,6 @@ commands =
6363
pip install -U -e .
6464
pylint --rcfile=./.pylintrc {posargs} polemarch
6565

66-
[testenv:selenium]
67-
basepython = python3.6
68-
passenv = DJANGO_LOG_LEVEL
69-
changedir = ./
70-
commands =
71-
coverage debug sys
72-
coverage erase
73-
coverage run -m polemarch test -v 2 --failfast --noinput selenium_tests
74-
coverage combine
75-
coverage report
76-
deps =
77-
cython>=0.28,<0.30
78-
selenium==3.14.1
79-
-e .
80-
-rrequirements-doc.txt
81-
-rrequirements-git.txt
82-
-rrequirements-test.txt
83-
8466
[testenv:build]
8567
basepython = python3.6
8668
passenv = *

0 commit comments

Comments
 (0)