Пример #1
0
def test_api_v1_schemas_views():
    DatabaseManager.auth_connector = AuthConnector_Mock()

    with app.test_request_context():
        response = schemas.api_v1_schemas_views("dummy", "dummy")

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('objects').get(
        'objects')[0] == 'NOSETEST_OBJECT'
Пример #2
0
def test_api_v1_transfers():
    DatabaseManager.meta_connector = MetaConnector_Mock()

    with app.test_request_context():
        response = transfers.api_v1_transfers()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('transfers')[0].get(
        'scheduler_transfer_id') == 'nosetest_id'
Пример #3
0
def test_api_v1_logs():
    DatabaseManager.meta_connector = MetaConnector_Mock()

    with app.test_request_context():
        response = logs.api_v1_logs()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('logs')[0].get(
        'log_source') == 'nosetest_source'
Пример #4
0
def test_api_v1_get_jobs():
    DatabaseManager.meta_connector = MetaConnector_Mock()

    with app.test_request_context():
        response = jobs.api_v1_get_jobs()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('jobs')[0].get(
        'source_schema_name') == 'nosetest_schema'
Пример #5
0
def test_api_v1_clusters():
    DatabaseManager.meta_connector = MetaConnector_Mock()

    with app.test_request_context():
        response = clusters.api_v1_clusters()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('clusters')[0].get(
        'cluster_address') == 'nosetest_host'
Пример #6
0
def test_api_v1_post_log():
    DatabaseManager.meta_connector = MetaConnector_Mock()
    DatabaseManager.auth_connector = AuthConnector_Mock()

    request_data = {'transfer_id': u'1', 'log_source': u'nosetest_source'}

    with app.test_request_context(method='POST', data=request_data):
        response = logs.api_v1_post_log()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('log_id') == 1
Пример #7
0
def test_api_v1_schemas():
    DatabaseManager.meta_connector = MetaConnector_Mock()
    DatabaseManager.auth_connector = AuthConnector_Mock()

    request_query_string = {'owner_username': u'user'}

    with app.test_request_context(query_string=request_query_string):
        response = schemas.api_v1_schemas()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('schemas').get(
        'available')[0].get('database') == 'nosetest_server1'
    assert json.loads(response.response[0].decode()).get('schemas').get(
        'unavailable')[0].get('database') == 'nosetest_server2'
Пример #8
0
def test_api_v1_post_job():
    DatabaseManager.meta_connector = MetaConnector_Mock()
    DatabaseManager.auth_connector = AuthConnector_Mock()

    request_data = {
        'source_schema_name': u'schema1',
        'owner_username': u'user',
        'source_server_id': u'1',
        'destination_path': u'path',
        'destination_cluster_id': u'1',
        'sqoop_direct': u'1',
        'source_object_name': u'NOSETEST_OBJECT',
        'workflow_suffix': u'wf'
    }

    with app.test_request_context(method='POST', data=request_data):
        response = jobs.api_v1_post_job()

    assert response._status == '200 OK'
    assert json.loads(response.response[0].decode()).get('job_id') == 1
Пример #9
0
def test_api_v1():
    with app.test_request_context():
        response = index.api_v1()

    assert response == "api_v1"
Пример #10
0
def test_headers():
    with app.test_request_context():
        response = headers.headers()

    assert "<b>PYTHON ENVIRONMENT VARIABLES</b>" in response