def setUp(self) -> None: self.app = create_app(config_module_class='amundsen_application.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push() self.app.config['CREDENTIALS_MODE_ADMIN_TOKEN'] = 'CREDENTIALS_MODE_ADMIN_TOKEN' self.app.config['CREDENTIALS_MODE_ADMIN_PASSWORD'] = '******' self.app.config['MODE_ORGANIZATION'] = 'foo'
import json import responses import unittest from http import HTTPStatus from amundsen_application import create_app from amundsen_application.api.search.v0 import _create_url_with_field local_app = create_app('amundsen_application.config.LocalConfig', 'static/templates') class SearchTest(unittest.TestCase): def setUp(self) -> None: self.mock_search_results = { 'total_results': 1, 'results': [ { 'cluster': 'test_cluster', 'column_names': [ 'column_1', 'column_2', 'column_3' ], 'database': 'test_db', 'description': 'This is a test', 'key': 'test_key', 'last_updated': 1527283287, 'name': 'test_table', 'schema_name': 'test_schema', 'tags': [],
import json import responses import unittest from http import HTTPStatus from unittest.mock import patch from amundsen_application import create_app from amundsen_application.api.search.v0 import SEARCH_DASHBOARD_ENDPOINT, SEARCH_DASHBOARD_FILTER_ENDPOINT, \ SEARCH_TABLE_ENDPOINT, SEARCH_TABLE_FILTER_ENDPOINT, SEARCH_USER_ENDPOINT local_app = create_app('amundsen_application.config.TestConfig', 'tests/templates') MOCK_TABLE_RESULTS = { 'total_results': 1, 'results': [{ 'cluster': 'test_cluster', 'column_names': ['column_1', 'column_2', 'column_3'], 'database': 'test_db', 'description': 'This is a test', 'key': 'test_key', 'last_updated_timestamp': 1527283287, 'name': 'test_table', 'schema': 'test_schema', 'schema_description': 'test_schema_description', 'tags': [], 'badges': [] }] }
import json import responses import unittest from http import HTTPStatus from amundsen_application import create_app from amundsen_application.api.metadata.v0 import \ TABLE_ENDPOINT, LAST_INDEXED_ENDPOINT, POPULAR_TABLES_ENDPOINT, TAGS_ENDPOINT local_app = create_app('amundsen_application.config.LocalConfig') class MetadataTest(unittest.TestCase): def setUp(self) -> None: self.mock_popular_tables = { 'popular_tables': [{ 'table_name': 'test_table', 'schema': 'test_schema', 'database': 'test_db', 'cluster': 'test_cluster', 'table_description': 'This is a test' }] } self.expected_parsed_popular_tables = [{ 'name': 'test_table', 'cluster': 'test_cluster', 'database': 'test_db', 'description': 'This is a test', 'key': 'test_db://test_cluster.test_schema/test_table', 'schema_name': 'test_schema',
import os from amundsen_application import create_app app = create_app( config_module_class=os.getenv('FRONTEND_SVC_CONFIG_MODULE_CLASS') or 'amundsen_application.config.LocalConfig') if __name__ == '__main__': app.run(host='0.0.0.0')
def setUp(self) -> None: self.app = create_app( config_module_class='amundsen_application.config.LocalConfig') self.app_context = self.app.app_context() self.app_context.push()
# Copyright Contributors to the Amundsen project. # SPDX-License-Identifier: Apache-2.0 import os from amundsen_application import create_app if not os.getenv('FRONTEND_SVC_CONFIG_MODULE_CLASS'): os.environ[ 'FRONTEND_SVC_CONFIG_MODULE_CLASS'] = 'amundsen_application.config.TestConfig' application = create_app() if __name__ == '__main__': application.run(host='0.0.0.0')
def setUp(self) -> None: self.app = create_app('amundsen_application.config.TestConfig', 'tests/templates') self.app_context = self.app.app_context() self.app_context.push()
import json import unittest from http import HTTPStatus from typing import Dict, List from flask import jsonify, make_response, Response from amundsen_application import create_app from amundsen_application.api.exceptions import MailClientNotImplemented from amundsen_application.api.utils.notification_utils import get_mail_client, \ get_notification_html, get_notification_subject, send_notification, NotificationType from amundsen_application.base.base_mail_client import BaseMailClient local_app = create_app('amundsen_application.config.TestConfig', 'tests/templates') local_no_notification_app = create_app( 'amundsen_application.config.TestNotificationsDisabledConfig', 'tests/templates') class MockMailClient(BaseMailClient): def __init__(self, status_code: int, recipients: List = []) -> None: self.status_code = status_code def send_email(self, sender: str = None, recipients: List = [], subject: str = None, text: str = None, html: str = None,
from amundsen_application import create_app CUSTOM_BUILD = '/usr/local/amundsen/frontend/configs/.custom_build' app = create_app(config_module_class='configs.config.FrontendConfig', template_folder=f'{CUSTOM_BUILD}/dist/templates') app.static_folder = CUSTOM_BUILD if __name__ == '__main__': app.run(host='0.0.0.0', port=5000)