Unverified Commit bc87e0f6 authored by Tamika Tannis's avatar Tamika Tannis Committed by GitHub

Cleanup blueprints for API version separation (#4)

* WIP

* Cleanup blueprint modifications

* Fix path error

* Update unit tests

* Cleanup imports
parent f53247c9
......@@ -7,8 +7,10 @@ from flask import Flask
from amundsen_application.api import init_routes
from amundsen_application.api.v0 import blueprint
from amundsen_application.api.announcements.v0 import announcements_blueprint
from amundsen_application.api.mail.v0 import mail_blueprint
from amundsen_application.api.metadata.v0 import metadata_blueprint
from amundsen_application.api.preview.v0 import preview_blueprint
from amundsen_application.api.search.v0 import search_blueprint
app_wrapper_class = Flask
......@@ -43,8 +45,10 @@ def create_app(config_module_class: str, template_folder: str = None) -> Flask:
logging.info('Created app with config name {}'.format(config_module_class))
app.register_blueprint(blueprint)
app.register_blueprint(announcements_blueprint)
app.register_blueprint(mail_blueprint)
app.register_blueprint(metadata_blueprint)
app.register_blueprint(preview_blueprint)
app.register_blueprint(search_blueprint)
init_routes(app)
......
import logging
from http import HTTPStatus
from pkg_resources import iter_entry_points
from flask import Response, jsonify, make_response
from flask.blueprints import Blueprint
LOGGER = logging.getLogger(__name__)
# TODO: Blueprint classes might be the way to go
ANNOUNCEMENT_CLIENT_CLASS = None
ANNOUNCEMENT_CLIENT_INSTANCE = None
# get the announcement_client_class from the python entry point
for entry_point in iter_entry_points(group='announcement_client', name='announcement_client_class'):
announcement_client_class = entry_point.load()
if announcement_client_class is not None:
ANNOUNCEMENT_CLIENT_CLASS = announcement_client_class
announcements_blueprint = Blueprint('announcements', __name__, url_prefix='/api/announcements/v0')
@announcements_blueprint.route('/', methods=['GET'])
def get_announcements() -> Response:
global ANNOUNCEMENT_CLIENT_INSTANCE
try:
if ANNOUNCEMENT_CLIENT_INSTANCE is None and ANNOUNCEMENT_CLIENT_CLASS is not None:
ANNOUNCEMENT_CLIENT_INSTANCE = ANNOUNCEMENT_CLIENT_CLASS()
if ANNOUNCEMENT_CLIENT_INSTANCE is None:
payload = jsonify({'posts': [], 'msg': 'A client for retrieving announcements must be configured'})
return make_response(payload, HTTPStatus.NOT_IMPLEMENTED)
return ANNOUNCEMENT_CLIENT_INSTANCE._get_posts()
except Exception as e:
message = 'Encountered exception: ' + str(e)
logging.exception(message)
payload = jsonify({'posts': [], 'msg': message})
return make_response(payload, HTTPStatus.INTERNAL_SERVER_ERROR)
......@@ -10,7 +10,7 @@ from amundsen_application.log.action_log import action_logging
LOGGER = logging.getLogger(__name__)
mail_blueprint = Blueprint('mail', __name__, url_prefix='/api/mail')
mail_blueprint = Blueprint('mail', __name__, url_prefix='/api/mail/v0')
@mail_blueprint.route('/feedback', methods=['POST'])
......
......@@ -20,7 +20,7 @@ REQUEST_SESSION_TIMEOUT = 10
POPULAR_TABLE_COUNT = 4
metadata_blueprint = Blueprint('metadata', __name__, url_prefix='/api/metadata')
metadata_blueprint = Blueprint('metadata', __name__, url_prefix='/api/metadata/v0')
def _get_table_endpoint() -> str:
......
import json
import logging
from http import HTTPStatus
from pkg_resources import iter_entry_points
from flask import Response, jsonify, make_response, request
from flask.blueprints import Blueprint
from amundsen_application.models.preview_data import PreviewDataSchema
LOGGER = logging.getLogger(__name__)
# TODO: Blueprint classes might be the way to go
PREVIEW_CLIENT_CLASS = None
PREVIEW_CLIENT_INSTANCE = None
# get the preview_client_class from the python entry point
for entry_point in iter_entry_points(group='preview_client', name='table_preview_client_class'):
preview_client_class = entry_point.load()
if preview_client_class is not None:
PREVIEW_CLIENT_CLASS = preview_client_class
preview_blueprint = Blueprint('preview', __name__, url_prefix='/api/preview/v0')
@preview_blueprint.route('/', methods=['POST'])
def get_table_preview() -> Response:
# TODO: Want to further separate this file into more blueprints, perhaps a Blueprint class is the way to go
global PREVIEW_CLIENT_INSTANCE
try:
if PREVIEW_CLIENT_INSTANCE is None and PREVIEW_CLIENT_CLASS is not None:
PREVIEW_CLIENT_INSTANCE = PREVIEW_CLIENT_CLASS()
if PREVIEW_CLIENT_INSTANCE is None:
payload = jsonify({'previewData': {}, 'msg': 'A client for the preview feature must be configured'})
return make_response(payload, HTTPStatus.NOT_IMPLEMENTED)
# request table preview data
response = PREVIEW_CLIENT_INSTANCE.get_preview_data(params=request.get_json())
status_code = response.status_code
preview_data = json.loads(response.data).get('preview_data')
if status_code == HTTPStatus.OK:
# validate the returned table preview data
data, errors = PreviewDataSchema().load(preview_data)
if not errors:
payload = jsonify({'previewData': data, 'msg': 'Success'})
else:
logging.error('Preview data dump returned errors: ' + str(errors))
raise Exception('The preview client did not return a valid PreviewData object')
else:
message = 'Encountered error: Preview client request failed with code ' + str(status_code)
logging.error(message)
# only necessary to pass the error text
payload = jsonify({'previewData': {'error_text': preview_data.get('error_text', '')}, 'msg': message})
return make_response(payload, status_code)
except Exception as e:
message = 'Encountered exception: ' + str(e)
logging.exception(message)
payload = jsonify({'previewData': {}, 'msg': message})
return make_response(payload, HTTPStatus.INTERNAL_SERVER_ERROR)
......@@ -16,7 +16,7 @@ LOGGER = logging.getLogger(__name__)
REQUEST_SESSION_TIMEOUT = 10
search_blueprint = Blueprint('search', __name__, url_prefix='/api')
search_blueprint = Blueprint('search', __name__, url_prefix='/api/search/v0')
valid_search_fields = {
'tag',
......@@ -53,7 +53,7 @@ def _validate_search_term(*, search_term: str, page_index: int) -> Optional[Resp
return None
@search_blueprint.route('/search', methods=['GET'])
@search_blueprint.route('/', methods=['GET'])
def search() -> Response:
search_term = get_query_param(request.args, 'query', 'Endpoint takes a "query" parameter')
page_index = get_query_param(request.args, 'page_index', 'Endpoint takes a "page_index" parameter')
......
import json
import logging
from http import HTTPStatus
from pkg_resources import iter_entry_points
from flask import Response, jsonify, make_response, request
from flask import Response
from flask import current_app as app
from flask.blueprints import Blueprint
# from amundsen_application.log.action_log import action_logging
from amundsen_application.models.preview_data import PreviewDataSchema
from amundsen_application.models.user import load_user
LOGGER = logging.getLogger(__name__)
# TODO: Blueprint classes might be the way to go
PREVIEW_CLIENT_CLASS = None
PREVIEW_CLIENT_INSTANCE = None
ANNOUNCEMENT_CLIENT_CLASS = None
ANNOUNCEMENT_CLIENT_INSTANCE = None
# get the preview_client_class from the python entry point
for entry_point in iter_entry_points(group='preview_client', name='table_preview_client_class'):
preview_client_class = entry_point.load()
if preview_client_class is not None:
PREVIEW_CLIENT_CLASS = preview_client_class
# get the announcement_client_class from the python entry point
for entry_point in iter_entry_points(group='announcement_client', name='announcement_client_class'):
announcement_client_class = entry_point.load()
if announcement_client_class is not None:
ANNOUNCEMENT_CLIENT_CLASS = announcement_client_class
blueprint = Blueprint('api', __name__, url_prefix='/api')
......@@ -44,61 +19,3 @@ def current_user() -> Response:
user = load_user({'display_name': '*'})
return user.to_json()
@blueprint.route('/preview', methods=['POST'])
def get_table_preview() -> Response:
# TODO: Want to further separate this file into more blueprints, perhaps a Blueprint class is the way to go
global PREVIEW_CLIENT_INSTANCE
try:
if PREVIEW_CLIENT_INSTANCE is None and PREVIEW_CLIENT_CLASS is not None:
PREVIEW_CLIENT_INSTANCE = PREVIEW_CLIENT_CLASS()
if PREVIEW_CLIENT_INSTANCE is None:
payload = jsonify({'previewData': {}, 'msg': 'A client for the preview feature must be configured'})
return make_response(payload, HTTPStatus.NOT_IMPLEMENTED)
# request table preview data
response = PREVIEW_CLIENT_INSTANCE.get_preview_data(params=request.get_json())
status_code = response.status_code
preview_data = json.loads(response.data).get('preview_data')
if status_code == HTTPStatus.OK:
# validate the returned table preview data
data, errors = PreviewDataSchema().load(preview_data)
if not errors:
payload = jsonify({'previewData': data, 'msg': 'Success'})
else:
logging.error('Preview data dump returned errors: ' + str(errors))
raise Exception('The preview client did not return a valid PreviewData object')
else:
message = 'Encountered error: Preview client request failed with code ' + str(status_code)
logging.error(message)
# only necessary to pass the error text
payload = jsonify({'previewData': {'error_text': preview_data.get('error_text', '')}, 'msg': message})
return make_response(payload, status_code)
except Exception as e:
message = 'Encountered exception: ' + str(e)
logging.exception(message)
payload = jsonify({'previewData': {}, 'msg': message})
return make_response(payload, HTTPStatus.INTERNAL_SERVER_ERROR)
@blueprint.route('/announcements', methods=['GET'])
def get_announcements() -> Response:
global ANNOUNCEMENT_CLIENT_INSTANCE
try:
if ANNOUNCEMENT_CLIENT_INSTANCE is None and ANNOUNCEMENT_CLIENT_CLASS is not None:
ANNOUNCEMENT_CLIENT_INSTANCE = ANNOUNCEMENT_CLIENT_CLASS()
if ANNOUNCEMENT_CLIENT_INSTANCE is None:
payload = jsonify({'posts': [], 'msg': 'A client for retrieving announcements must be configured'})
return make_response(payload, HTTPStatus.NOT_IMPLEMENTED)
return ANNOUNCEMENT_CLIENT_INSTANCE._get_posts()
except Exception as e:
message = 'Encountered exception: ' + str(e)
logging.exception(message)
payload = jsonify({'posts': [], 'msg': message})
return make_response(payload, HTTPStatus.INTERNAL_SERVER_ERROR)
......@@ -5,7 +5,7 @@ import axios from 'axios';
export function announcementsGet() {
return axios({
method: 'get',
url: '/api/announcements',
url: '/api/announcements/v0/',
})
.then((response) => {
return response.data.posts
......
......@@ -8,7 +8,7 @@ export function feedbackSubmitFeedback(action: SubmitFeedbackRequest) {
return axios({
data,
method: 'post',
url: '/api/mail/feedback',
url: '/api/mail/v0/feedback',
timeout: 5000,
headers: {'Content-Type': 'multipart/form-data' }
})
......
import axios from 'axios';
const API_PATH = '/api/metadata/v0';
const sortTagsAlphabetical = (a, b) => a.tag_name.localeCompare(b.tag_name);
function getTableParams(tableDataObject) {
......@@ -8,7 +9,7 @@ function getTableParams(tableDataObject) {
}
export function metadataPopularTables() {
return axios.get('/api/metadata/popular_tables').then((response) => {
return axios.get(`${API_PATH}/popular_tables`).then((response) => {
return response.data.results;
})
.catch((error) => {
......@@ -17,7 +18,7 @@ export function metadataPopularTables() {
}
export function metadataAllTags() {
return axios.get('/api/metadata/tags').then((response) => {
return axios.get(`${API_PATH}/tags`).then((response) => {
return response.data.tags.sort(sortTagsAlphabetical);
})
.catch((error) => {
......@@ -28,7 +29,7 @@ export function metadataAllTags() {
export function metadataTableTags(tableData) {
const tableParams = getTableParams(tableData);
return axios.get(`/api/metadata/table?${tableParams}&index=&source=`).then((response) => {
return axios.get(`${API_PATH}/table?${tableParams}&index=&source=`).then((response) => {
const newTableData = response.data.tableData;
newTableData.tags = newTableData.tags.sort(sortTagsAlphabetical);
return newTableData;
......@@ -41,7 +42,7 @@ export function metadataTableTags(tableData) {
export function metadataUpdateTableTags(action, tableData) {
const updatePayloads = action.tagArray.map(tagObject => ({
method: tagObject.methodName,
url: '/api/metadata/update_table_tags',
url: `${API_PATH}/update_table_tags`,
data: {
cluster: tableData.cluster,
db: tableData.database,
......@@ -58,7 +59,7 @@ export function metadataGetTableData(action) {
const { searchIndex, source } = action;
const tableParams = getTableParams(action);
return axios.get(`/api/metadata/table?${tableParams}&index=${searchIndex}&source=${source}`).then((response) => {
return axios.get(`${API_PATH}/table?${tableParams}&index=${searchIndex}&source=${source}`).then((response) => {
const tableData = response.data.tableData;
tableData.tags = tableData.tags.sort(sortTagsAlphabetical);
return { tableData, statusCode: response.status };
......@@ -70,7 +71,7 @@ export function metadataGetTableData(action) {
export function metadataGetTableDescription(tableData) {
const tableParams = getTableParams(tableData);
return axios.get(`/api/metadata/get_table_description?${tableParams}`).then((response) => {
return axios.get(`${API_PATH}/v0/get_table_description?${tableParams}`).then((response) => {
tableData.table_description = response.data.description;
return tableData;
})
......@@ -84,7 +85,7 @@ export function metadataUpdateTableDescription(description, tableData) {
throw new Error();
}
else {
return axios.put('/api/metadata/put_table_description', {
return axios.put(`${API_PATH}/put_table_description`, {
description,
db: tableData.database,
cluster: tableData.cluster,
......@@ -98,7 +99,7 @@ export function metadataUpdateTableDescription(description, tableData) {
export function metadataUpdateTableOwner(owner, method, tableData) {
return axios({
method,
url: '/api/metadata/update_table_owner',
url: `${API_PATH}/update_table_owner`,
data: {
owner,
db: tableData.database,
......@@ -112,7 +113,7 @@ export function metadataUpdateTableOwner(owner, method, tableData) {
export function metadataGetColumnDescription(columnIndex, tableData) {
const tableParams = getTableParams(tableData);
const columnName = tableData.columns[columnIndex].name;
return axios.get(`/api/metadata/get_column_description?${tableParams}&column_name=${columnName}`).then((response) => {
return axios.get(`${API_PATH}/get_column_description?${tableParams}&column_name=${columnName}`).then((response) => {
tableData.columns[columnIndex].description = response.data.description;
return tableData;
})
......@@ -127,7 +128,7 @@ export function metadataUpdateColumnDescription(description, columnIndex, tableD
}
else {
const columnName = tableData.columns[columnIndex].name;
return axios.put('/api/metadata/put_column_description', {
return axios.put(`${API_PATH}/put_column_description`, {
description,
db: tableData.database,
cluster: tableData.cluster,
......@@ -141,7 +142,7 @@ export function metadataUpdateColumnDescription(description, columnIndex, tableD
export function metadataGetLastIndexed() {
return axios.get('/api/metadata/get_last_indexed').then((response) => {
return axios.get(`${API_PATH}/get_last_indexed`).then((response) => {
return response.data.timestamp;
});
}
......@@ -4,7 +4,7 @@ import { GetPreviewDataRequest } from '../../preview/reducer';
export function getPreviewData(action: GetPreviewDataRequest) {
return axios({
url:'/api/preview',
url: '/api/preview/v0/',
method: 'POST',
data: action.queryParams,
})
......
......@@ -11,7 +11,7 @@ function transformSearchResults(data) {
export function searchExecuteSearch(action) {
const { term, pageIndex } = action;
return axios.get(`/api/search?query=${term}&page_index=${pageIndex}`)
return axios.get(`/api/search/v0/?query=${term}&page_index=${pageIndex}`)
.then(response => transformSearchResults(response.data))
.catch(() => transformSearchResults(error.response.data));
.catch((error) => transformSearchResults(error.response.data));
}
......@@ -44,7 +44,7 @@ class MailTest(unittest.TestCase):
:return:
"""
with local_app.test_client() as test:
response = test.post('/api/mail/feedback', json={
response = test.post('/api/mail/v0/feedback', json={
'rating': '10', 'comment': 'test'
})
self.assertEqual(response.status_code, HTTPStatus.NOT_IMPLEMENTED)
......@@ -56,7 +56,7 @@ class MailTest(unittest.TestCase):
"""
local_app.config['MAIL_CLIENT'] = MockMailClient(status_code=200)
with local_app.test_client() as test:
response = test.post('/api/mail/feedback', json={
response = test.post('/api/mail/v0/feedback', json={
'rating': '10', 'comment': 'test'
})
self.assertEqual(response.status_code, HTTPStatus.OK)
......@@ -68,7 +68,7 @@ class MailTest(unittest.TestCase):
"""
local_app.config['MAIL_CLIENT'] = MockBadClient()
with local_app.test_client() as test:
response = test.post('/api/mail/feedback', json={
response = test.post('/api/mail/v0/feedback', json={
'rating': '10', 'comment': 'test'
})
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
......@@ -82,7 +82,7 @@ class MailTest(unittest.TestCase):
expected_code = HTTPStatus.BAD_REQUEST
local_app.config['MAIL_CLIENT'] = MockMailClient(status_code=expected_code)
with local_app.test_client() as test:
response = test.post('/api/mail/feedback', json={
response = test.post('/api/mail/v0/feedback', json={
'rating': '10', 'comment': 'test'
})
self.assertEqual(response.status_code, expected_code)
......@@ -171,7 +171,7 @@ class MetadataTest(unittest.TestCase):
json=self.mock_popular_tables, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/metadata/popular_tables')
response = test.get('/api/metadata/v0/popular_tables')
data = json.loads(response.data)
self.assertEqual(response.status_code, HTTPStatus.OK)
self.assertCountEqual(data.get('results'), self.expected_parsed_popular_tables)
......@@ -187,7 +187,7 @@ class MetadataTest(unittest.TestCase):
json=self.mock_popular_tables, status=HTTPStatus.BAD_REQUEST)
with local_app.test_client() as test:
response = test.get('/api/metadata/popular_tables')
response = test.get('/api/metadata/v0/popular_tables')
self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)
@responses.activate
......@@ -201,7 +201,7 @@ class MetadataTest(unittest.TestCase):
json={'popular_tables': None}, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/metadata/popular_tables')
response = test.get('/api/metadata/v0/popular_tables')
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
@responses.activate
......@@ -215,7 +215,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.get(
'/api/metadata/table',
'/api/metadata/v0/table',
query_string=dict(
db='db',
cluster='cluster',
......@@ -240,7 +240,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.put(
'/api/metadata/update_table_owner',
'/api/metadata/v0/update_table_owner',
json={
'db': 'db',
'cluster': 'cluster',
......@@ -261,7 +261,7 @@ class MetadataTest(unittest.TestCase):
json={'neo4j_latest_timestamp': 1538352000}, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/metadata/get_last_indexed')
response = test.get('/api/metadata/v0/get_last_indexed')
data = json.loads(response.data)
self.assertEqual(response.status_code, HTTPStatus.OK)
self.assertEqual(data.get('timestamp'), 1538352000)
......@@ -277,7 +277,7 @@ class MetadataTest(unittest.TestCase):
json=None, status=HTTPStatus.BAD_REQUEST)
with local_app.test_client() as test:
response = test.get('/api/metadata/get_last_indexed')
response = test.get('/api/metadata/v0/get_last_indexed')
self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)
@responses.activate
......@@ -291,7 +291,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.get(
'/api/metadata/get_table_description',
'/api/metadata/v0/get_table_description',
query_string=dict(db='db', cluster='cluster', schema='schema', table='table')
)
data = json.loads(response.data)
......@@ -310,7 +310,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.get(
'/api/metadata/get_table_description',
'/api/metadata/v0/get_table_description',
query_string=dict(db='db', cluster='cluster', schema='schema', table='table')
)
self.assertEqual(response.status_code, HTTPStatus.BAD_REQUEST)
......@@ -326,7 +326,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.put(
'/api/metadata/put_table_description',
'/api/metadata/v0/put_table_description',
json={
'db': 'db',
'cluster': 'cluster',
......@@ -349,7 +349,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.get(
'/api/metadata/get_column_description',
'/api/metadata/v0/get_column_description',
query_string=dict(
db='db',
cluster='cluster',
......@@ -375,7 +375,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.get(
'/api/metadata/get_column_description',
'/api/metadata/v0/get_column_description',
query_string=dict(
db='db',
cluster='cluster',
......@@ -399,7 +399,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.put(
'/api/metadata/put_column_description',
'/api/metadata/v0/put_column_description',
json={
'db': 'db',
'cluster': 'cluster',
......@@ -422,7 +422,7 @@ class MetadataTest(unittest.TestCase):
responses.add(responses.GET, url, json=self.mock_tags, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/metadata/tags')
response = test.get('/api/metadata/v0/tags')
data = json.loads(response.data)
self.assertCountEqual(data.get('tags'), self.expected_parsed_tags)
......@@ -437,7 +437,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.put(
'/api/metadata/update_table_tags',
'/api/metadata/v0/update_table_tags',
json={
'db': 'db',
'cluster': 'cluster',
......@@ -459,7 +459,7 @@ class MetadataTest(unittest.TestCase):
with local_app.test_client() as test:
response = test.delete(
'/api/metadata/update_table_tags',
'/api/metadata/v0/update_table_tags',
json={
'db': 'db',
'cluster': 'cluster',
......
......@@ -55,7 +55,7 @@ class SearchTest(unittest.TestCase):
:return:
"""
with local_app.test_client() as test:
response = test.get('/api/search', query_string=dict(page_index='0'))
response = test.get('/api/search/v0/', query_string=dict(page_index='0'))
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
def test_search_fail_if_no_page_index(self) -> None:
......@@ -65,7 +65,7 @@ class SearchTest(unittest.TestCase):
:return:
"""
with local_app.test_client() as test:
response = test.get('/api/search', query_string=dict(query='test'))
response = test.get('/api/search/v0/', query_string=dict(query='test'))
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
@responses.activate
......@@ -78,7 +78,7 @@ class SearchTest(unittest.TestCase):
json=self.mock_search_results, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/search', query_string=dict(query='test', page_index='0'))
response = test.get('/api/search/v0/', query_string=dict(query='test', page_index='0'))
data = json.loads(response.data)
self.assertEqual(response.status_code, HTTPStatus.OK)
self.assertEqual(data.get('total_results'), self.mock_search_results.get('total_results'))
......@@ -94,7 +94,7 @@ class SearchTest(unittest.TestCase):
json=self.mock_search_results, status=HTTPStatus.INTERNAL_SERVER_ERROR)
with local_app.test_client() as test:
response = test.get('/api/search', query_string=dict(query='test', page_index='0'))
response = test.get('/api/search/v0/', query_string=dict(query='test', page_index='0'))
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
@responses.activate
......@@ -108,7 +108,7 @@ class SearchTest(unittest.TestCase):
json=self.bad_search_results, status=HTTPStatus.OK)
with local_app.test_client() as test:
response = test.get('/api/search', query_string=dict(query='test', page_index='0'))
response = test.get('/api/search/v0/', query_string=dict(query='test', page_index='0'))
self.assertEqual(response.status_code, HTTPStatus.INTERNAL_SERVER_ERROR)
@responses.activate
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment