diff --git a/Makefile b/Makefile index 42954796c..961cc499d 100644 --- a/Makefile +++ b/Makefile @@ -10,13 +10,13 @@ install: pip3 install . test: - ./tests_with_redis.sh + sh ./tests_with_redis.sh unittest: pytest -m unittest devtest: - ./tests_with_redis.sh dev + sh ./tests_with_redis.sh dev integrationtest: - ./tests_with_redis.sh integrationtest + sh ./tests_with_redis.sh integrationtest diff --git a/docker/actinia-core-tests/Dockerfile b/docker/actinia-core-tests/Dockerfile index 75f6f3b65..c0e8cf9ba 100644 --- a/docker/actinia-core-tests/Dockerfile +++ b/docker/actinia-core-tests/Dockerfile @@ -41,8 +41,6 @@ RUN grass --tmp-location EPSG:4326 --exec g.extension -s \ COPY docker/actinia-core-alpine/actinia.cfg /etc/default/actinia COPY docker/actinia-core-tests/actinia-test.cfg /etc/default/actinia_test -COPY requirements.txt /src/requirements.txt -RUN pip3 install -r /src/requirements.txt RUN pip3 install pytest pytest-cov # TODO: Postgres for tests @@ -50,7 +48,6 @@ RUN pip3 install pytest pytest-cov COPY . /src/actinia_core WORKDIR /src/actinia_core -RUN chmod a+x tests_with_redis.sh RUN make install diff --git a/src/actinia_core/cli/webhook_server.py b/src/actinia_core/cli/webhook_server.py index a9b11e0d7..bcb692a2e 100644 --- a/src/actinia_core/cli/webhook_server.py +++ b/src/actinia_core/cli/webhook_server.py @@ -29,7 +29,7 @@ import psutil from flask import Flask, make_response, jsonify, request, json from multiprocessing import Process -from werkzeug.exceptions import BadRequest +from werkzeug.exceptions import BadRequest, UnsupportedMediaType from pprint import pprint @@ -44,10 +44,13 @@ @flask_app.route("/webhook/finished", methods=["GET", "POST"]) def finished(): + try: pprint(json.loads(request.get_json())) except BadRequest: pass + except UnsupportedMediaType: + pass except TypeError: pass return make_response(jsonify("OK"), 200) @@ -59,6 +62,8 @@ def update(): pprint(json.loads(request.get_json())) except BadRequest: pass + except UnsupportedMediaType: + pass except TypeError: pass return make_response(jsonify("OK"), 200) diff --git a/src/actinia_core/cli/webhook_server_broken.py b/src/actinia_core/cli/webhook_server_broken.py index 266c27a59..e28aedf88 100644 --- a/src/actinia_core/cli/webhook_server_broken.py +++ b/src/actinia_core/cli/webhook_server_broken.py @@ -29,7 +29,7 @@ import psutil from flask import Flask, make_response, jsonify, request, json from multiprocessing import Process -from werkzeug.exceptions import BadRequest +from werkzeug.exceptions import BadRequest, UnsupportedMediaType from pprint import pprint @@ -49,6 +49,8 @@ def finished(): pprint(json.loads(request.get_json())) except BadRequest: pass + except UnsupportedMediaType: + pass except TypeError: pass sp = Process(target=shutdown_server, args=(port,)) @@ -62,6 +64,8 @@ def update(): pprint(json.loads(request.get_json())) except BadRequest: pass + except UnsupportedMediaType: + pass except TypeError: pass return make_response(jsonify("OK"), 200)