mirror of
https://github.com/Telecominfraproject/oopt-gnpy-api.git
synced 2025-10-28 16:52:19 +00:00
FIX: api version is now consistent with release
Change-Id: I25582e7937ec912666e2ba48d5687ec3ae694883
This commit is contained in:
committed by
EstherLerouzic
parent
7695db8674
commit
c30308eb92
@@ -4,6 +4,9 @@
|
||||
"""
|
||||
from flask import Flask
|
||||
|
||||
API_VERSION = "/api/v0.1"
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
import gnpyapi.core.route.path_request_route # noqa: F401, E402
|
||||
import gnpyapi.core.route.path_request_route # noqa: E402
|
||||
import gnpyapi.core.route.status_route # noqa: F401, E402
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# coding: utf-8
|
||||
from pathlib import Path
|
||||
|
||||
from flask import request
|
||||
|
||||
@@ -7,14 +6,12 @@ from gnpyapi.core import app
|
||||
from gnpyapi.core.exception.equipment_error import EquipmentError
|
||||
from gnpyapi.core.exception.topology_error import TopologyError
|
||||
from gnpyapi.core.service.path_request_service import PathRequestService
|
||||
from gnpyapi.core import API_VERSION
|
||||
|
||||
PATH_COMPUTATION_BASE_PATH = '/api/v1/path-computation'
|
||||
PATH_REQUEST_BASE_PATH = '/api/v1/path-request'
|
||||
AUTODESIGN_PATH = PATH_COMPUTATION_BASE_PATH + '/<path_computation_id>/autodesign'
|
||||
|
||||
_examples_dir = Path(__file__).parent.parent.parent / 'example-data'
|
||||
PATH_REQUEST_BASE_PATH = '/path-request'
|
||||
|
||||
|
||||
@app.route(API_VERSION + PATH_REQUEST_BASE_PATH, methods=['POST'])
|
||||
@app.route(PATH_REQUEST_BASE_PATH, methods=['POST'])
|
||||
def path_request(path_request_service: PathRequestService):
|
||||
data = request.json
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
# coding: utf-8
|
||||
from gnpyapi.core import app
|
||||
from gnpyapi.core import API_VERSION
|
||||
|
||||
|
||||
@app.route('/api/v1/status', methods=['GET'])
|
||||
@app.route(API_VERSION + '/status', methods=['GET'])
|
||||
def api_status():
|
||||
return {"version": "v1", "status": "ok"}, 200
|
||||
return {"version": "v0.1", "status": "ok"}, 200
|
||||
|
||||
@@ -17,7 +17,7 @@ TEST_DATA_DIR = Path(__file__).parent / 'data'
|
||||
TEST_REQ_DIR = TEST_DATA_DIR / 'req'
|
||||
TEST_RES_DIR = TEST_DATA_DIR / 'res'
|
||||
|
||||
API_VERSION = '/api/v1'
|
||||
API_VERSION = '/api/v0.1'
|
||||
|
||||
|
||||
def read_json_file(path):
|
||||
@@ -40,3 +40,9 @@ def test_echo(client):
|
||||
response = client.post(f"{API_VERSION}/path-request", json=input_data)
|
||||
assert response.status_code == 201
|
||||
assert response.get_json() == expected_response
|
||||
|
||||
|
||||
def test_status(client):
|
||||
response = client.get(f"{API_VERSION}/status")
|
||||
assert response.status_code == 200
|
||||
assert response.get_json() == {"version": "v0.1", "status": "ok"}
|
||||
|
||||
Reference in New Issue
Block a user