Example #1
0
def vcap_services(redis_port):
    return TEST_VCAP_SERVICES_TEMPLATE.format(
        redis_port=redis_port,
        redis_password="******",
        redis_host='localhost',
        downloader_host='localhost:{}'.format(DOWNLOADER_STUB_PORT),
        metadata_parser_host='localhost:{}'.format(METADATAPARSER_STUB_PORT),
        user_management_host='localhost:{}'.format(USER_MANAGEMENT_STUB_PORT),
        verification_key_url='http://localhost:{}'.format(UAA_STUB_PORT))
Example #2
0
def vcap_services(redis_port):
    return TEST_VCAP_SERVICES_TEMPLATE.format(
        redis_port=redis_port,
        redis_password="******",
        redis_host='localhost',
        downloader_host='localhost:{}'.format(DOWNLOADER_STUB_PORT),
        metadata_parser_host='localhost:{}'.format(METADATAPARSER_STUB_PORT),
        user_management_host='localhost:{}'.format(USER_MANAGEMENT_STUB_PORT),
        verification_key_url='http://localhost:{}'.format(UAA_STUB_PORT)
    )
Example #3
0
import json
import os
import pytest

from data_acquisition.cf_app_utils.auth import USER_MANAGEMENT_PATH
from tests.consts import TEST_VCAP_APPLICATION, TEST_VCAP_SERVICES_TEMPLATE
from data_acquisition import DasConfig
from data_acquisition.config import BadConfigurationPathError, NoServiceConfigurationError
from data_acquisition.consts import DOWNLOADER_PATH, METADATA_PARSER_PATH

TEST_VCAP_SERVICES = TEST_VCAP_SERVICES_TEMPLATE.format(
    redis_port=11111,
    redis_password='******',
    redis_host='10.10.10.10',
    downloader_host='downloader.example.com',
    metadata_parser_host='metadata-parser.example.com',
    user_management_host='user-management.example.com',
    verification_key_url='http://uaa.example.com/token_key',
)


def test_config_creation():
    os.environ['VCAP_SERVICES'] = TEST_VCAP_SERVICES
    os.environ['VCAP_APPLICATION'] = TEST_VCAP_APPLICATION
    os.environ['VCAP_APP_PORT'] = '12345'
    config = DasConfig.get_config()

    assert config.self_url == 'https://das.example.com'
    assert config.port == 12345

    assert config.redis_port == 11111
Example #4
0
import json
import os
import pytest

from data_acquisition.cf_app_utils.auth import USER_MANAGEMENT_PATH
from tests.consts import TEST_VCAP_APPLICATION, TEST_VCAP_SERVICES_TEMPLATE
from data_acquisition import DasConfig
from data_acquisition.config import BadConfigurationPathError, NoServiceConfigurationError
from data_acquisition.consts import DOWNLOADER_PATH, METADATA_PARSER_PATH

TEST_VCAP_SERVICES = TEST_VCAP_SERVICES_TEMPLATE.format(
    redis_port=11111,
    redis_password='******',
    redis_host='10.10.10.10',
    downloader_host='downloader.example.com',
    metadata_parser_host='metadata-parser.example.com',
    user_management_host='user-management.example.com',
    verification_key_url='http://uaa.example.com/token_key',
)


def test_config_creation():
    os.environ['VCAP_SERVICES'] = TEST_VCAP_SERVICES
    os.environ['VCAP_APPLICATION'] = TEST_VCAP_APPLICATION
    os.environ['VCAP_APP_PORT'] = '12345'
    config = DasConfig.get_config()

    assert config.self_url == 'https://das.example.com'
    assert config.port == 12345

    assert config.redis_port == 11111