コード例 #1
0
def test_satellite_admin_settings_exception():
    with pytest.raises(SkipException):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_SETTINGS_BAD_1))
    with pytest.raises(ParseException):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_SETTINGS_BAD_2))
コード例 #2
0
def test_satellite_admin_settings():
    settings = satellite_postgresql_query.SatelliteAdminSettings(
        context_wrap(SATELLITE_SETTINGS_2))
    assert (len(settings)) == 2
    assert not settings.get_setting('unregister_delete_host')
    assert settings.get_setting('destroy_vm_on_host_delete')

    settings = satellite_postgresql_query.SatelliteAdminSettings(
        context_wrap(SATELLITE_SETTINGS_3))
    assert (len(settings)) == 2
    assert not settings.get_setting('unregister_delete_host')
    assert not settings.get_setting('destroy_vm_on_host_delete')
    assert settings.get_setting('non_exist_column') is None

    table = satellite_postgresql_query.SatelliteAdminSettings(
        context_wrap(SATELLITE_SETTINGS_WITH_DIFFERENT_TYPES))
    setting_value = table.get_setting('ignored_interface_identifiers')
    assert isinstance(setting_value, list)
    for item in [
            'lo', 'en*v*', 'usb*', 'vnet*', 'macvtap*', '_vdsmdummy_', 'veth*',
            'docker*', 'tap*', 'qbr*', 'qvb*', 'qvo*', 'qr-*', 'qg-*',
            'vlinuxbr*', 'vovsbr*'
    ]:
        assert item in setting_value
    setting_value = table.get_setting('foreman_tasks_troubleshooting_url')
    assert isinstance(setting_value, str)
    assert setting_value == 'https://access.redhat.com/solutions/satellite6-tasks#%{label}'
    setting_value = table.get_setting('foreman_tasks_sync_task_timeout')
    assert isinstance(setting_value, int)
    assert setting_value == 120
コード例 #3
0
def test_HTL_doc_examples():
    settings = satellite_postgresql_query.SatelliteAdminSettings(
        context_wrap(SATELLITE_SETTINGS_1))
    resources_table = satellite_postgresql_query.SatelliteComputeResources(
        context_wrap(SATELLITE_COMPUTE_RESOURCE_1))
    sat_sca_info = satellite_postgresql_query.SatelliteSCAStatus(
        context_wrap(SATELLITE_SCA_INFO_1))
    repositories = satellite_postgresql_query.SatelliteKatelloEmptyURLRepositories(
        context_wrap(SATELLITE_KATELLO_ROOT_REPOSITORIES))
    tasks = satellite_postgresql_query.SatelliteCoreTaskReservedResourceCount(
        context_wrap(SATELLITE_TASK_RESERVERDRESOURCE_CONTENT))
    capsules = satellite_postgresql_query.SatelliteQualifiedCapsules(
        context_wrap(SATELLITE_CAPSULES_WITH_BACKGROUND_DOWNLOADPOLICY))
    repos = satellite_postgresql_query.SatelliteQualifiedKatelloRepos(
        context_wrap(SATELLITE_REPOS_INFO))
    multi_ref_katello_repos = satellite_postgresql_query.SatelliteKatellloReposWithMultipleRef(
        context_wrap(SATELLITE_KATELLO_REPOS_WITH_MULTI_REF))
    globs = {
        'table': settings,
        'resources_table': resources_table,
        'sat_sca_info': sat_sca_info,
        'katello_root_repositories': repositories,
        'tasks': tasks,
        'capsules': capsules,
        'repos': repos,
        'multi_ref_katello_repos': multi_ref_katello_repos
    }
    failed, _ = doctest.testmod(satellite_postgresql_query, globs=globs)
    assert failed == 0
コード例 #4
0
def test_basic_output_with_satellite_admin_setting():
    with pytest.raises(ContentException):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_POSTGRESQL_WRONG_1))
    with pytest.raises(ValueError):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_POSTGRESQL_WRONG_2))
    with pytest.raises(ValueError):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_POSTGRESQL_WRONG_3))
    with pytest.raises(ValueError):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_POSTGRESQL_WRONG_4))
    with pytest.raises(SkipException):
        satellite_postgresql_query.SatelliteAdminSettings(
            context_wrap(SATELLITE_POSTGRESQL_WRONG_5))
コード例 #5
0
def test_HTL_doc_examples():
    query = satellite_postgresql_query.SatellitePostgreSQLQuery(
        context_wrap(test_data_3))
    settings = satellite_postgresql_query.SatelliteAdminSettings(
        context_wrap(SATELLITE_SETTINGS_1))
    resources_table = satellite_postgresql_query.SatelliteComputeResources(
        context_wrap(SATELLITE_COMPUTE_RESOURCE_1))
    globs = {
        'query': query,
        'table': settings,
        'resources_table': resources_table,
    }
    failed, tested = doctest.testmod(satellite_postgresql_query, globs=globs)
    assert failed == 0