From dcea69a6835895c72505b0611216637f42c8ee73 Mon Sep 17 00:00:00 2001 From: mstoro <78480384+mstoro@users.noreply.github.com> Date: Fri, 5 Nov 2021 14:10:58 +0200 Subject: [PATCH] [CCTRI-3125] remove unused endpoints (#49) --- code/api/enrich.py | 6 ------ code/api/respond.py | 17 ----------------- code/app.py | 2 -- code/tests/unit/api/test_enrich.py | 1 - code/tests/unit/api/test_respond.py | 29 ----------------------------- code/tests/unit/test_app.py | 3 --- 6 files changed, 58 deletions(-) delete mode 100644 code/api/respond.py delete mode 100644 code/tests/unit/api/test_respond.py diff --git a/code/api/enrich.py b/code/api/enrich.py index 5c78771..27a73dd 100644 --- a/code/api/enrich.py +++ b/code/api/enrich.py @@ -16,12 +16,6 @@ get_observables = partial(get_json, schema=ObservableSchema(many=True)) -@enrich_api.route('/deliberate/observables', methods=['POST']) -def deliberate_observables(): - # There are no verdicts to extract. - return jsonify_data({}) - - @enrich_api.route('/observe/observables', methods=['POST']) def observe_observables(): input_observables = get_observables() diff --git a/code/api/respond.py b/code/api/respond.py deleted file mode 100644 index b3e550c..0000000 --- a/code/api/respond.py +++ /dev/null @@ -1,17 +0,0 @@ -from flask import Blueprint - -from api.utils import jsonify_data - -respond_api = Blueprint('respond', __name__) - - -@respond_api.route('/respond/observables', methods=['POST']) -def respond_observables(): - # There are no actions to list. - return jsonify_data([]) - - -@respond_api.route('/respond/trigger', methods=['POST']) -def respond_trigger(): - # There are no actions to trigger. - return jsonify_data({'status': 'failure'}) diff --git a/code/app.py b/code/app.py index a98659e..c159dea 100644 --- a/code/app.py +++ b/code/app.py @@ -2,7 +2,6 @@ from api.enrich import enrich_api from api.health import health_api -from api.respond import respond_api from api.version import version_api from api.watchdog import watchdog_api @@ -16,7 +15,6 @@ app.register_blueprint(health_api) app.register_blueprint(enrich_api) -app.register_blueprint(respond_api) app.register_blueprint(version_api) app.register_blueprint(watchdog_api) diff --git a/code/tests/unit/api/test_enrich.py b/code/tests/unit/api/test_enrich.py index 154bbdc..1a0fea1 100644 --- a/code/tests/unit/api/test_enrich.py +++ b/code/tests/unit/api/test_enrich.py @@ -59,7 +59,6 @@ def avotx_api_route(request): def all_routes(): - yield '/deliberate/observables' yield '/observe/observables' yield '/refer/observables' diff --git a/code/tests/unit/api/test_respond.py b/code/tests/unit/api/test_respond.py deleted file mode 100644 index 8525687..0000000 --- a/code/tests/unit/api/test_respond.py +++ /dev/null @@ -1,29 +0,0 @@ -from http import HTTPStatus - -from pytest import fixture - - -def routes(): - yield '/respond/observables' - yield '/respond/trigger' - - -@fixture(scope='module', params=routes(), ids=lambda route: f'POST {route}') -def route(request): - return request.param - - -@fixture(scope='module') -def expected_payload(route): - if route.endswith('/observables'): - return {'data': []} - - if route.endswith('/trigger'): - return {'data': {'status': 'failure'}} - - -def test_respond_call_success(route, client, expected_payload): - response = client.post(route) - - assert response.status_code == HTTPStatus.OK - assert response.get_json() == expected_payload diff --git a/code/tests/unit/test_app.py b/code/tests/unit/test_app.py index c621163..3278787 100644 --- a/code/tests/unit/test_app.py +++ b/code/tests/unit/test_app.py @@ -14,11 +14,8 @@ def calls(): yield Call('DELETE', '/delete', HTTPStatus.NOT_FOUND) yield Call('GET', '/health', HTTPStatus.METHOD_NOT_ALLOWED) - yield Call('GET', '/deliberate/observables', HTTPStatus.METHOD_NOT_ALLOWED) yield Call('GET', '/observe/observables', HTTPStatus.METHOD_NOT_ALLOWED) yield Call('GET', '/refer/observables', HTTPStatus.METHOD_NOT_ALLOWED) - yield Call('GET', '/respond/observables', HTTPStatus.METHOD_NOT_ALLOWED) - yield Call('GET', '/respond/trigger', HTTPStatus.METHOD_NOT_ALLOWED) yield Call('GET', '/version', HTTPStatus.METHOD_NOT_ALLOWED) yield Call('POST', '/watchdog', HTTPStatus.METHOD_NOT_ALLOWED)