Skip to content

Commit

Permalink
Fixes currently failing test (#455)
Browse files Browse the repository at this point in the history
* fix test_async_processing_new

* switch except error order
  • Loading branch information
mmacata authored Jun 23, 2023
1 parent 0943a9c commit caa8a40
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
3 changes: 0 additions & 3 deletions docker/actinia-core-tests/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,16 +41,13 @@ 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
# using tests/data/poly.gpkg

COPY . /src/actinia_core
WORKDIR /src/actinia_core
RUN chmod a+x tests_with_redis.sh

RUN make install

Expand Down
7 changes: 6 additions & 1 deletion src/actinia_core/cli/webhook_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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)
Expand All @@ -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)
Expand Down
6 changes: 5 additions & 1 deletion src/actinia_core/cli/webhook_server_broken.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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,))
Expand All @@ -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)
Expand Down

0 comments on commit caa8a40

Please sign in to comment.