コード例 #1
0
ファイル: environment.py プロジェクト: flopezag/fiware-aiakos
def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
        - Init Aiakos API Client
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
    # The loaded properties will be available in 'configuration_manager.config' variable.
    __logger__.info("Loading project properties")
    configuration_manager.set_up_project()
    config = configuration_manager.config

    # Init Aiakos Client
    context.aiakos_client = \
        AiakosApiClient(protocol=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_PROTOCOL],
                        host=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST],
                        port=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_PORT],
                        base_resource=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_RESOURCE])

    # Init remote-command client
    context.remote_executor = \
        FabricUtils(host_name=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST],
                    host_username=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST_USER],
                    host_ssh_key=config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_HOST_PKEY])
コード例 #2
0
ファイル: environment.py プロジェクト: geonexus/fiware-facts
def before_all(context):

    __logger__.info("START ...")
    __logger__.info("Setting UP acceptance test project ")

    set_up_project()  # Load setting using 'qautils.configuration.configuration_utils'

    # Save tenantId
    context.tenant_id = \
        configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID]

    # Create REST Clients
    context.facts_client = FactsClient(
        protocol=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_SERVICE_PROTOCOL],
        host=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST],
        port=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_SERVICE_PORT],
        resource=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE][PROPERTIES_CONFIG_SERVICE_RESOURCE])

    context.cloto_client = ClotoClient(
        username=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_USERNAME],
        password=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_PASSWORD],
        tenant_id=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID],
        auth_url=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL],
        api_protocol=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_PROTOCOL],
        api_host=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_HOST],
        api_port=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_PORT],
        api_resource=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_RESOURCE])
コード例 #3
0
    def init_auth(cls):
        """
        Init the variables related to authorization, needed to execute tests
        :return: The auth token retrieved
        """
        configuration_manager.set_up_project()
        config = configuration_manager.config

        tenant_id = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID]
        auth_url = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL]
        user_name = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_USERNAME]
        password = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_PASSWORD]
        tenant_name = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_TENANT_NAME]
        domain_name = config[PROPERTIES_CONFIG_AIAKOS][
            PROPERTIES_CONFIG_SERVICE_OS_DOMAIN_NAME]

        cred_kwargs = {
            'auth_url': auth_url,
            'username': user_name,
            'password': password
        }

        # Currently, both v2 and v3 Identity API versions are supported
        if cls.auth_api == 'v2.0':
            cred_kwargs['tenant_name'] = tenant_name
        elif cls.auth_api == 'v3':
            cred_kwargs['user_domain_name'] = domain_name
        else:
            assert False, "Identity API {} ({}) not supported".format(
                cls.auth_api, auth_url)
        # Instantiate a Password object
        try:
            identity_package = 'keystoneclient.auth.identity.%s' % cls.auth_api.replace(
                '.0', '')
            identity_module = __import__(identity_package,
                                         fromlist=['Password'])
            password_class = getattr(identity_module, 'Password')
            __logger__.debug("Authentication with %s", password_class)
            credentials = password_class(**cred_kwargs)
        except (ImportError, AttributeError) as e:
            assert False, "Could not find Identity API {} Password class: {}".format(
                cls.auth_api, e)
        # Get auth token
        __logger__.debug("Getting auth token for tenant %s...", tenant_id)
        cls.auth_sess = session.Session(auth=credentials)
        try:
            cls.auth_token = cls.auth_sess.get_token()
        except (KeystoneClientException, KeystoneConnectionRefused) as e:
            __logger__.error("No auth token (%s): all tests will be skipped",
                             e.message)
        return cls.auth_token
コード例 #4
0
ファイル: authentication.py プロジェクト: Fiware/ops.Aiakos
    def init_auth(cls):
        """
        Init the variables related to authorization, needed to execute tests
        :return: The auth token retrieved
        """
        configuration_manager.set_up_project()
        config = configuration_manager.config

        tenant_id = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID]
        auth_url = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL]
        user_name = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_USERNAME]
        password = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_PASSWORD]
        tenant_name = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_TENANT_NAME]
        domain_name = config[PROPERTIES_CONFIG_AIAKOS][PROPERTIES_CONFIG_SERVICE_OS_DOMAIN_NAME]

        cred_kwargs = {
        'auth_url': auth_url,
        'username': user_name,
        'password': password
        }

        # Currently, both v2 and v3 Identity API versions are supported
        if cls.auth_api == 'v2.0':
            cred_kwargs['tenant_name'] = tenant_name
        elif cls.auth_api == 'v3':
            cred_kwargs['user_domain_name'] = domain_name
        else:
            assert False, "Identity API {} ({}) not supported".format(cls.auth_api, auth_url)
        # Instantiate a Password object
        try:
            identity_package = 'keystoneclient.auth.identity.%s' % cls.auth_api.replace('.0', '')
            identity_module = __import__(identity_package, fromlist=['Password'])
            password_class = getattr(identity_module, 'Password')
            __logger__.debug("Authentication with %s", password_class)
            credentials = password_class(**cred_kwargs)
        except (ImportError, AttributeError) as e:
            assert False, "Could not find Identity API {} Password class: {}".format(cls.auth_api, e)
        # Get auth token
        __logger__.debug("Getting auth token for tenant %s...", tenant_id)
        cls.auth_sess = session.Session(auth=credentials)
        try:
            cls.auth_token = cls.auth_sess.get_token()
        except (KeystoneClientException, KeystoneConnectionRefused) as e:
            __logger__.error("No auth token (%s): all tests will be skipped", e.message)
        return cls.auth_token
コード例 #5
0
def before_all(context):

    __logger__.info("START ...")
    __logger__.info("Setting UP acceptance test project ")

    set_up_project(
    )  # Load setting using 'qautils.configuration.configuration_utils'

    # Save tenantId
    context.tenant_id = \
        configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE][PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID]

    # Create REST Clients
    context.facts_client = FactsClient(
        protocol=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PROTOCOL],
        host=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_HOST],
        port=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PORT],
        resource=configuration_utils.config[PROPERTIES_CONFIG_FACTS_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_RESOURCE])

    context.cloto_client = ClotoClient(
        username=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_OS_USERNAME],
        password=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_OS_PASSWORD],
        tenant_id=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_OS_TENANT_ID],
        auth_url=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_OS_AUTH_URL],
        api_protocol=configuration_utils.
        config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PROTOCOL],
        api_host=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_HOST],
        api_port=configuration_utils.config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_PORT],
        api_resource=configuration_utils.
        config[PROPERTIES_CONFIG_CLOTO_SERVICE]
        [PROPERTIES_CONFIG_SERVICE_RESOURCE])
コード例 #6
0
ファイル: environment.py プロジェクト: Fiware/ops.Health
def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
    # The loaded properties will be available in 'configuration_manager.config'
    __logger__.info("Loading project properties")
    configuration_manager.set_up_project()
    config = configuration_manager.config

    context.dashboard_url = config['dashboard']['protocol'] + '://' + \
        config['dashboard']['host'] + ':' + \
        config['dashboard']['port'] + \
        config['dashboard']['web_context']

    if config['dashboard']['selenium'] == 'yes':
        context.selenium = True
        context.driver = webdriver.Firefox()
    else:
        context.selenium = False
コード例 #7
0
ファイル: environment.py プロジェクト: flopezag/fiware-health
def before_all(context):
    """
    HOOK: To be executed before all.
        - Load project properties
    """

    __logger__.info("Setting UP execution")

    # Load project properties.
    # The loaded properties will be available in 'configuration_manager.config'
    __logger__.info("Loading project properties")
    configuration_manager.set_up_project()
    config = configuration_manager.config

    context.dashboard_url = config['dashboard']['protocol'] + '://' + \
        config['dashboard']['host'] + ':' + \
        config['dashboard']['port'] + \
        config['dashboard']['web_context']

    if config['dashboard']['selenium'] == 'yes':
        context.selenium = True
        context.driver = webdriver.Firefox()
    else:
        context.selenium = False