def test_vm_install_package(value):
    """Install a package with all supported distros and cdn not cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :expectedresults: Package is install is installed
    """
    # the value is support distro DISTRO_RH6 or DISTRO_RH7
    # this will create 4 tests:
    #  - one test with disto rhel6 cdn False
    #  - one test with distro rhel7 cdn False
    #  - one test with disto rhel6 cdn True
    #  - one test with distro rhel7 cdn True
    distro, cdn = value
    org = make_org()
    lce = make_lifecycle_environment({'organization-id': org['id']})
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn),
            YumRepository(url=FAKE_0_YUM_REPO)
        ]
    )
    # this will create repositories , content view and activation key
    repos_collection.setup_content(org['id'], lce['id'], upload_manifest=True)
    with VirtualMachine(distro=distro) as vm:
        # this will install katello ca, register vm host, enable rh repos,
        # install katello-agent
        repos_collection.setup_virtual_machine(vm)
        # install a package
        result = vm.run('yum -y install {0}'.format(FAKE_0_CUSTOM_PACKAGE))
        assert result.return_code == 0
Beispiel #2
0
def test_positive_end_to_end_register(session):
    """Create activation key and use it during content host registering

    :id: dfaecf6a-ba61-47e1-87c5-f8966a319b41

    :expectedresults: Content host was registered successfully using activation
        key, association is reflected on webUI

    :CaseLevel: System

    :CaseImportance: High
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[SatelliteToolsRepository()]
    )
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    ak_name = repos_collection.setup_content_data['activation_key']['name']
    with VirtualMachine(distro=DISTRO_RHEL7) as vm:
        repos_collection.setup_virtual_machine(vm)
        with session:
            session.organization.select(org.name)
            chost = session.contenthost.read(vm.hostname)
            assert (
                    chost['details']['registered_by'] == 'Activation Key {}'
                    .format(ak_name)
            )
            ak_values = session.activationkey.read(ak_name)
            assert len(ak_values['content_hosts']['table']) == 1
            assert ak_values['content_hosts']['table'][0]['Name'] == vm.hostname
Beispiel #3
0
def test_positive_list(session, org, lce):
    """View all errata in an Org

    :id: 71c7a054-a644-4c1e-b304-6bc34ea143f4

    :Setup: Errata synced on satellite server.

    :Steps: Create two Orgs each having a product synced which contains errata.

    :expectedresults: Check that the errata belonging to one Org is not showing in the other.

    :BZ: 1659941, 1837767

    :customerscenario: true

    :CaseLevel: Integration
    """
    rc = RepositoryCollection(
        repositories=[YumRepository(settings.repos.yum_3.url)])
    rc.setup_content(org.id, lce.id)
    with session:
        assert (session.errata.search(
            CUSTOM_REPO_ERRATA_ID,
            applicable=False)[0]['Errata ID'] == CUSTOM_REPO_ERRATA_ID)
        assert not session.errata.search(settings.repos.yum_3.errata[5],
                                         applicable=False)
        session.organization.select(org_name=org.name)
        assert (session.errata.search(
            settings.repos.yum_3.errata[5],
            applicable=False)[0]['Errata ID'] == settings.repos.yum_3.errata[5]
                )
        assert not session.errata.search(CUSTOM_REPO_ERRATA_ID,
                                         applicable=False)
def test_vm_install_package(value, module_org, module_lce):
    """Install a package with all supported distros and cdn not cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :expectedresults: Package is install is installed
    """
    # the value is support distro DISTRO_RH6 or DISTRO_RH7
    # this will create 4 tests:
    #  - one test with disto rhel6 cdn False
    #  - one test with distro rhel7 cdn False
    #  - one test with disto rhel6 cdn True
    #  - one test with distro rhel7 cdn True
    distro, cdn = value
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn),
            YumRepository(url=FAKE_0_YUM_REPO),
            DockerRepository(url=DOCKER_REGISTRY_HUB, upstream_name=DOCKER_UPSTREAM_NAME),
            PuppetRepository(url=CUSTOM_PUPPET_REPO,
                             modules=[dict(name='generic_1', author='robottelo')])
        ]
    )
    # this will create repositories , content view and activation key
    repos_collection.setup_content(module_org['id'], module_lce['id'], upload_manifest=True)
    with VirtualMachine(distro=distro) as vm:
        # this will install katello ca, register vm host, enable rh repos,
        # install katello-agent
        repos_collection.setup_virtual_machine(vm, enable_custom_repos=True)
        # install a package
        result = vm.run('yum -y install {0}'.format(FAKE_0_CUSTOM_PACKAGE))
        assert result.return_code == 0
def test_positive_errata_view_organization_switch(session, module_org,
                                                  module_lce, module_repos_col,
                                                  target_sat):
    """Verify no errata list visible on Organization switch

    :id: faad9cf3-f8d5-49a6-87d1-431837b67675

    :Steps: Create an Organization having a product synced which contains errata.

    :expectedresults: Verify that the errata belonging to one Organization is not
                      showing in the Default organization.

    :CaseImportance: High

    :CaseLevel: Integration
    """
    rc = RepositoryCollection(
        repositories=[YumRepository(settings.repos.yum_3.url)])
    rc.setup_content(module_org.id, module_lce.id)
    with session:
        assert (session.errata.search(
            CUSTOM_REPO_ERRATA_ID,
            applicable=False)[0]['Errata ID'] == CUSTOM_REPO_ERRATA_ID)
        session.organization.select(org_name="Default Organization")
        assert not session.errata.search(CUSTOM_REPO_ERRATA_ID,
                                         applicable=False)
Beispiel #6
0
def test_positive_list(session, module_repos_col, module_lce):
    """View all errata in an Org

    :id: 71c7a054-a644-4c1e-b304-6bc34ea143f4

    :Setup: Errata synced on satellite server.

    :Steps: Create two Orgs each having a product synced which contains errata.

    :expectedresults: Check that the errata belonging to one Org is not showing in the other.

    :BZ: 1659941

    :CaseLevel: Integration
    """
    org = entities.Organization().create()
    org_env = entities.LifecycleEnvironment(organization=org).create()
    org_repos_col = RepositoryCollection(repositories=[YumRepository(FAKE_3_YUM_REPO)])
    org_repos_col.setup_content(org.id, org_env.id)
    with session:
        assert (session.errata.search(CUSTOM_REPO_ERRATA_ID, applicable=False)[0]['Errata ID']
                == CUSTOM_REPO_ERRATA_ID)
        assert not session.errata.search(FAKE_3_ERRATA_ID, applicable=False)
        session.organization.select(org_name=org.name)
        assert (session.errata.search(FAKE_3_ERRATA_ID, applicable=False)[0]['Errata ID']
                == FAKE_3_ERRATA_ID)
        assert not session.errata.search(CUSTOM_REPO_ERRATA_ID, applicable=False)
def test_positive_list(session, module_repos_col, module_lce):
    """View all errata in an Org

    :id: 71c7a054-a644-4c1e-b304-6bc34ea143f4

    :Setup: Errata synced on satellite server.

    :Steps: Create two Orgs each having a product synced which contains errata.

    :expectedresults: Check that the errata belonging to one Org is not showing in the other.

    :BZ: 1659941

    :CaseLevel: Integration
    """
    org = entities.Organization().create()
    org_env = entities.LifecycleEnvironment(organization=org).create()
    org_repos_col = RepositoryCollection(
        repositories=[YumRepository(FAKE_3_YUM_REPO)])
    org_repos_col.setup_content(org.id, org_env.id)
    with session:
        assert (session.errata.search(
            CUSTOM_REPO_ERRATA_ID,
            applicable=False)[0]['Errata ID'] == CUSTOM_REPO_ERRATA_ID)
        assert not session.errata.search(FAKE_3_ERRATA_ID, applicable=False)
        session.organization.select(org_name=org.name)
        assert (session.errata.search(
            FAKE_3_ERRATA_ID,
            applicable=False)[0]['Errata ID'] == FAKE_3_ERRATA_ID)
        assert not session.errata.search(CUSTOM_REPO_ERRATA_ID,
                                         applicable=False)
Beispiel #8
0
def module_repos_collection_module_stream(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL8,
        repositories=[YumRepository(url=CUSTOM_MODULE_STREAM_REPO_2)])
    repos_collection.setup_content(module_org.id,
                                   module_lce.id,
                                   upload_manifest=True)
    return repos_collection
Beispiel #9
0
def repos_collection(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=constants.DISTRO_RHEL8,
        repositories=[YumRepository(url=repos.CUSTOM_SWID_TAG_REPO)])
    repos_collection.setup_content(module_org.id,
                                   module_lce.id,
                                   upload_manifest=True)
    return repos_collection
Beispiel #10
0
def repos_collection(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=constants.DISTRO_RHEL8,
        repositories=[YumRepository(url=settings.repos.swid_tag.url)])
    repos_collection.setup_content(module_org.id,
                                   module_lce.id,
                                   upload_manifest=True)
    return repos_collection
Beispiel #11
0
def test_positive_view_vdc_subscription_products(session):
    """Ensure that Virtual Datacenters subscription provided products is
    not empty and that a consumed product exist in content products.

    :id: cc4593f0-66ab-4bf6-87d1-d4bd9c89eba5

    :customerscenario: true

    :steps:
        1. Upload a manifest with Virtual Datacenters subscription
        2. Enable a products provided by Virtual Datacenters subscription,
           and synchronize the auto created repository
        3. Create content view with the product repository, and publish it
        4. Create a lifecycle environment and promote the content view to
           it.
        5. Create an activation key with the content view and lifecycle
           environment
        6. Subscribe a host to the activation key
        7. Goto Hosts -> Content hosts and select the created content host
        8. Attach VDC subscription to content host
        9. Goto Content -> Red Hat Subscription
        10. Select Virtual Datacenters subscription

    :expectedresults:
        1. assert that the provided products is not empty
        2. assert that the enabled product is in subscription Product Content

    :BZ: 1366327

    :CaseLevel: System
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7, repositories=[RHELAnsibleEngineRepository(cdn=True)]
    )
    product_name = repos_collection.rh_repos[0].data['product']
    repos_collection.setup_content(
        org.id, lce.id, upload_manifest=True, rh_subscriptions=[DEFAULT_SUBSCRIPTION_NAME]
    )
    with VirtualMachine() as vm:
        setup_virtual_machine(
            vm,
            org.label,
            activation_key=repos_collection.setup_content_data['activation_key']['name'],
            install_katello_agent=False,
        )
        with session:
            session.organization.select(org.name)
            session.contenthost.add_subscription(vm.hostname, VDC_SUBSCRIPTION_NAME)
            provided_products = session.subscription.provided_products(VDC_SUBSCRIPTION_NAME)
            # ensure that subscription provided products list is not empty and that the product is
            # in the provided products.
            assert provided_products and product_name in provided_products
            content_products = session.subscription.content_products(VDC_SUBSCRIPTION_NAME)
            # ensure that subscription enabled products list is not empty and that product is in
            # content products.
            assert content_products and product_name in content_products
Beispiel #12
0
def repos_collection_for_module_streams(module_org):
    """Adds required repositories, AK, LCE and CV for content host testing for
    module streams"""
    lce = entities.LifecycleEnvironment(organization=module_org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL8,
        repositories=[YumRepository(url=CUSTOM_MODULE_STREAM_REPO_2)])
    repos_collection.setup_content(module_org.id, lce.id, upload_manifest=True)
    return repos_collection
Beispiel #13
0
def test_positive_view_vdc_subscription_products(session):
    """Ensure that Virtual Datacenters subscription provided products is
    not empty and that a consumed product exist in content products.

    :id: cc4593f0-66ab-4bf6-87d1-d4bd9c89eba5

    :customerscenario: true

    :steps:
        1. Upload a manifest with Virtual Datacenters subscription
        2. Enable a products provided by Virtual Datacenters subscription,
           and synchronize the auto created repository
        3. Create content view with the product repository, and publish it
        4. Create a lifecycle environment and promote the content view to
           it.
        5. Create an activation key with the content view and lifecycle
           environment
        6. Subscribe a host to the activation key
        7. Goto Hosts -> Content hosts and select the created content host
        8. Attach VDC subscription to content host
        9. Goto Content -> Red Hat Subscription
        10. Select Virtual Datacenters subscription

    :expectedresults:
        1. assert that the provided products is not empty
        2. assert that the enabled product is in subscription Product Content

    :BZ: 1366327

    :CaseLevel: System
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7, repositories=[RHELAnsibleEngineRepository(cdn=True)])
    product_name = repos_collection.rh_repos[0].data['product']
    repos_collection.setup_content(
        org.id, lce.id, upload_manifest=True, rh_subscriptions=[DEFAULT_SUBSCRIPTION_NAME])
    with VirtualMachine() as vm:
        setup_virtual_machine(
            vm,
            org.label,
            activation_key=repos_collection.setup_content_data['activation_key']['name'],
            install_katello_agent=False
        )
        with session:
            session.organization.select(org.name)
            session.contenthost.add_subscription(vm.hostname, VDC_SUBSCRIPTION_NAME)
            provided_products = session.subscription.provided_products(VDC_SUBSCRIPTION_NAME)
            # ensure that subscription provided products list is not empty and that the product is
            # in the provided products.
            assert provided_products and product_name in provided_products
            content_products = session.subscription.content_products(VDC_SUBSCRIPTION_NAME)
            # ensure that subscription enabled products list is not empty and that product is in
            # content products.
            assert content_products and product_name in content_products
Beispiel #14
0
def module_rhva_repos_col(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL6,
        repositories=[
            YumRepository(url=CUSTOM_REPO_URL),
            VirtualizationAgentsRepository(cdn=True),
        ],
    )
    repos_collection.setup_content(module_org.id, module_lce.id)
    return repos_collection
Beispiel #15
0
def module_repos_collection(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_DEFAULT,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_1_YUM_REPO),
            YumRepository(url=FAKE_6_YUM_REPO),
        ],
    )
    repos_collection.setup_content(module_org.id, module_lce.id, upload_manifest=True)
    return repos_collection
Beispiel #16
0
def module_rhva_repos_col(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL6,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=CUSTOM_REPO_URL),
            VirtualizationAgentsRepository(cdn=True),
        ]
    )
    repos_collection.setup_content(module_org.id, module_lce.id)
    return repos_collection
Beispiel #17
0
def module_repos_collection(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_DEFAULT,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_1_YUM_REPO),
            YumRepository(url=FAKE_6_YUM_REPO),
        ]
    )
    repos_collection.setup_content(
        module_org.id, module_lce.id, upload_manifest=True)
    return repos_collection
Beispiel #18
0
def module_repos_col(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            RHELAnsibleEngineRepository(cdn=True),
            YumRepository(url=CUSTOM_REPO_URL),
        ])
    repos_collection.setup_content(module_org.id, module_lce.id)
    return repos_collection
Beispiel #19
0
def module_repos_collection(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=constants.DISTRO_DEFAULT,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=settings.repos.yum_1.url),
            YumRepository(url=settings.repos.yum_6.url),
        ],
    )
    repos_collection.setup_content(module_org.id,
                                   module_lce.id,
                                   upload_manifest=True)
    return repos_collection
Beispiel #20
0
def repos_collection(module_org):
    """Adds required repositories, AK, LCE and CV for content host testing"""
    lce = entities.LifecycleEnvironment(organization=module_org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            RHELAnsibleEngineRepository(cdn=True),
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_1_YUM_REPO),
            YumRepository(url=FAKE_6_YUM_REPO)
        ])
    repos_collection.setup_content(module_org.id, lce.id, upload_manifest=True)
    return repos_collection
Beispiel #21
0
def module_repos_col(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            RHELAnsibleEngineRepository(cdn=True),
            YumRepository(url=CUSTOM_REPO_URL),
        ]
    )
    repos_collection.setup_content(module_org.id, module_lce.id)
    return repos_collection
def repos_collection(module_org):
    """Adds required repositories, AK, LCE and CV for content host testing"""
    lce = entities.LifecycleEnvironment(organization=module_org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            RHELAnsibleEngineRepository(cdn=True),
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_1_YUM_REPO),
            YumRepository(url=FAKE_6_YUM_REPO)
        ]
    )
    repos_collection.setup_content(module_org.id, lce.id, upload_manifest=True)
    return repos_collection
def module_erratatype_repos_col(module_org, module_lce):
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            RHELAnsibleEngineRepository(cdn=True),
            # add a repo with errata of different types (security, advisory, etc)
            YumRepository(url=FAKE_9_YUM_REPO),
        ],
    )
    repos_collection.setup_content(module_org.id, module_lce.id)
    return repos_collection
Beispiel #24
0
def test_positive_content_host_subscription_status(session):
    """Check if the Content Host Subscription Status is working in the
    Dashboard UI

    :id: ce0d7b0c-ae6a-4361-8173-e50f6381194a

    :Steps:

        1. Register Content Host and subscribe it
        2. Navigate Monitor -> Dashboard
        3. Review the Content Host Subscription Status
        4. Click each link:

            a. Invalid Subscriptions
            b. Valid Subscriptions

    :expectedresults: The widget is updated with all details for Valid,
        and Invalid Subscriptions

    :CaseLevel: System
    """
    org = entities.Organization().create()
    env = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(cdn=True),
        ]
    )
    repos_collection.setup_content(org.id, env.id, upload_manifest=True)
    with VirtualMachine(distro=DISTRO_RHEL7) as client:
        repos_collection.setup_virtual_machine(client)
        assert client.subscribed
        with session:
            session.organization.select(org_name=org.name)
            session.dashboard.action({'HostSubscription': {'type': 'Invalid'}})
            values = session.contenthost.read_all()
            assert values['searchbox'] == 'subscription_status = invalid'
            assert len(values['table']) == 0
            session.dashboard.action({'HostSubscription': {'type': 'Valid'}})
            values = session.contenthost.read_all()
            assert values['searchbox'] == 'subscription_status = valid'
            assert len(values['table']) == 1
            assert values['table'][0]['Name'] == client.hostname
            assert values['table'][0]['Lifecycle Environment'] == env.name
            cv_name = repos_collection._setup_content_data[
                'content_view']['name']
            assert values['table'][0]['Content View'] == cv_name
Beispiel #25
0
def test_positive_sync_rh_repos(session, module_org_with_manifest):
    """Create Content RedHat Sync with two repos.

    :id: e30f6509-0b65-4bcc-a522-b4f3089d3911

    :expectedresults: Sync procedure for RedHat Repos is successful

    :CaseLevel: Integration
    """
    repos = (SatelliteCapsuleRepository(cdn=True), RHELCloudFormsTools(cdn=True))
    distros = [DISTRO_RHEL7, DISTRO_RHEL6]
    repo_collections = [
        RepositoryCollection(distro=distro, repositories=[repo])
        for distro, repo in zip(distros, repos)
    ]
    for repo_collection in repo_collections:
        repo_collection.setup(module_org_with_manifest.id, synchronize=False)
    repo_paths = [
        (
            repo.repo_data['product'],
            repo.repo_data.get('releasever'),
            repo.repo_data.get('arch'),
            repo.repo_data['name'],
        )
        for repo in repos
    ]
    with session:
        session.organization.select(org_name=module_org_with_manifest.name)
        results = session.sync_status.synchronize(repo_paths)
        assert len(results) == len(repo_paths)
        assert all([result == 'Syncing Complete.' for result in results])
Beispiel #26
0
def module_repos_col(module_org, module_lce, module_target_sat, request):
    upload_manifest_locked(org_id=module_org.id)
    repos_collection = RepositoryCollection(
        repositories=[
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            YumRepository(url=settings.repos.yum_0.url),
        ], )
    repos_collection.setup_content(module_org.id, module_lce.id)
    yield repos_collection

    @request.addfinalizer
    def _cleanup():
        try:
            module_target_sat.api.Subscription(
                organization=module_org).delete_manifest(
                    data={'organization_id': module_org.id})
        except Exception:
            logger.exception('Exception cleaning manifest:')
Beispiel #27
0
 def setUpClass(cls):
     """Create Org, Lifecycle Environment, Content View, Activation key"""
     super(ErrataSwidTagsTestCase, cls).setUpClass()
     cls.org = entities.Organization().create()
     cls.lce = entities.LifecycleEnvironment(organization=cls.org).create()
     cls.repos_collection = RepositoryCollection(
         distro=DISTRO_RHEL8,
         repositories=[YumRepository(url=CUSTOM_SWID_TAG_REPO)])
     cls.repos_collection.setup_content(cls.org.id,
                                        cls.lce.id,
                                        upload_manifest=True)
def test_vm_install_package(org, lce, distro, cdn):
    """Install a package with all supported distros and cdn / non-cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :parametrized: yes

    :expectedresults: Package is install is installed
    """
    if distro == DISTRO_RHEL6:
        pytest.skip(f'{DISTRO_RHEL6!s} skipped until ELS subscriptions are in manifest.')
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn, distro=distro),
            YumRepository(url=FAKE_0_YUM_REPO),
            DockerRepository(url=CONTAINER_REGISTRY_HUB, upstream_name=CONTAINER_UPSTREAM_NAME),
            PuppetRepository(
                url=CUSTOM_PUPPET_REPO, modules=[dict(name='generic_1', author='robottelo')]
            ),
        ],
    )
    # Create repos, content view, and activation key.
    repos_collection.setup_content(org['id'], lce['id'], upload_manifest=True)
    with VMBroker(nick=distro, host_classes={'host': ContentHost}) as host:
        # install katello-agent
        repos_collection.setup_virtual_machine(
            host, enable_custom_repos=True, install_katello_agent=False
        )
        # install a package from custom repo
        result = host.execute(f'yum -y install {FAKE_0_CUSTOM_PACKAGE}')
        assert result.status == 0
Beispiel #29
0
def test_vm_install_package(value, module_org, module_lce):
    """Install a package with all supported distros and cdn not cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :expectedresults: Package is install is installed
    """
    # the value is support distro DISTRO_RH6 or DISTRO_RH7
    # this will create 4 tests:
    #  - one test with disto rhel6 cdn False
    #  - one test with distro rhel7 cdn False
    #  - one test with disto rhel6 cdn True
    #  - one test with distro rhel7 cdn True
    distro, cdn = value
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn),
            YumRepository(url=FAKE_0_YUM_REPO),
            DockerRepository(url=DOCKER_REGISTRY_HUB, upstream_name=DOCKER_UPSTREAM_NAME),
            PuppetRepository(
                url=CUSTOM_PUPPET_REPO, modules=[dict(name='generic_1', author='robottelo')]
            ),
        ],
    )
    # this will create repositories , content view and activation key
    repos_collection.setup_content(module_org['id'], module_lce['id'], upload_manifest=True)
    with VirtualMachine(distro=distro) as vm:
        # this will install katello ca, register vm host, enable rh repos,
        # install katello-agent
        repos_collection.setup_virtual_machine(vm, enable_custom_repos=True)
        # install a package
        result = vm.run('yum -y install {0}'.format(FAKE_0_CUSTOM_PACKAGE))
        assert result.return_code == 0
def test_vm_install_package(value):
    """Install a package with all supported distros and cdn not cdn variants

    :id: b2a6065a-69f6-4805-a28b-eaaa812e0f4b

    :expectedresults: Package is install is installed
    """
    # the value is support distro DISTRO_RH6 or DISTRO_RH7
    # this will create 4 tests:
    #  - one test with disto rhel6 cdn False
    #  - one test with distro rhel7 cdn False
    #  - one test with disto rhel6 cdn True
    #  - one test with distro rhel7 cdn True
    distro, cdn = value
    org = make_org()
    lce = make_lifecycle_environment({'organization-id': org['id']})
    repos_collection = RepositoryCollection(
        distro=distro,
        repositories=[
            SatelliteToolsRepository(cdn=cdn),
            YumRepository(url=FAKE_0_YUM_REPO)
        ])
    # this will create repositories , content view and activation key
    repos_collection.setup_content(org['id'], lce['id'], upload_manifest=True)
    with VirtualMachine(distro=distro) as vm:
        # this will install katello ca, register vm host, enable rh repos,
        # install katello-agent
        repos_collection.setup_virtual_machine(vm)
        # install a package
        result = vm.run('yum -y install {0}'.format(FAKE_0_CUSTOM_PACKAGE))
        assert result.return_code == 0
Beispiel #31
0
def test_positive_end_to_end_register(session, rhel7_contenthost, default_sat):
    """Create activation key and use it during content host registering

    :id: dfaecf6a-ba61-47e1-87c5-f8966a319b41

    :expectedresults: Content host was registered successfully using activation
        key, association is reflected on webUI

    :CaseLevel: System

    :parametrized: yes

    :CaseImportance: High
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=constants.DISTRO_RHEL7,
        repositories=[SatelliteToolsRepository()])
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    ak_name = repos_collection.setup_content_data['activation_key']['name']

    repos_collection.setup_virtual_machine(rhel7_contenthost, default_sat)
    with session:
        session.organization.select(org.name)
        chost = session.contenthost.read(rhel7_contenthost.hostname,
                                         widget_names='details')
        assert chost['details']['registered_by'] == f'Activation Key {ak_name}'
        ak_values = session.activationkey.read(ak_name,
                                               widget_names='content_hosts')
        assert len(ak_values['content_hosts']['table']) == 1
        assert ak_values['content_hosts']['table'][0][
            'Name'] == rhel7_contenthost.hostname
Beispiel #32
0
def test_positive_content_host_subscription_status(session):
    """Check if the Content Host Subscription Status is working in the
    Dashboard UI

    :id: ce0d7b0c-ae6a-4361-8173-e50f6381194a

    :Steps:

        1. Register Content Host and subscribe it
        2. Navigate Monitor -> Dashboard
        3. Review the Content Host Subscription Status
        4. Click each link:

            a. Invalid Subscriptions
            b. Valid Subscriptions

    :expectedresults: The widget is updated with all details for Valid,
        and Invalid Subscriptions

    :CaseLevel: System
    """
    org = entities.Organization().create()
    env = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(cdn=True),
        ]
    )
    repos_collection.setup_content(org.id, env.id, upload_manifest=True)
    with VirtualMachine(distro=DISTRO_RHEL7) as client:
        repos_collection.setup_virtual_machine(client)
        assert client.subscribed
        with session:
            session.organization.select(org_name=org.name)
            session.dashboard.action({'HostSubscription': {'type': 'Invalid'}})
            values = session.contenthost.read_all()
            assert values['searchbox'] == 'subscription_status = invalid'
            assert len(values['table']) == 0
            session.dashboard.action({'HostSubscription': {'type': 'Valid'}})
            values = session.contenthost.read_all()
            assert values['searchbox'] == 'subscription_status = valid'
            assert len(values['table']) == 1
            assert values['table'][0]['Name'] == client.hostname
            assert values['table'][0]['Lifecycle Environment'] == env.name
            cv_name = repos_collection._setup_content_data[
                'content_view']['name']
            assert values['table'][0]['Content View'] == cv_name
Beispiel #33
0
def test_positive_end_to_end(session):
    """Create all entities required for content host, set up host, register it
    as a content host, read content host details, install package and errata.

    :id: f43f2826-47c1-4069-9c9d-2410fd1b622c

    :expectedresults: content host details are the same as expected, package
        and errata installation are successful

    :CaseLevel: System
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_1_YUM_REPO)
        ])
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    with VirtualMachine(distro=DISTRO_RHEL7) as vm:
        repos_collection.setup_virtual_machine(vm)
        result = vm.run('yum -y install {0}'.format(FAKE_1_CUSTOM_PACKAGE))
        assert result.return_code == 0
        with session:
            session.organization.select(org.name)
            # Ensure content host is searchable
            assert session.contenthost.search(
                vm.hostname)[0]['Name'] == vm.hostname
            chost = session.contenthost.read(vm.hostname)
            # Ensure all content host fields/tabs have appropriate values
            assert chost['details']['name'] == vm.hostname
            assert (chost['details']['content_view'] == repos_collection.
                    setup_content_data['content_view']['name'])
            assert chost['details']['lce'][lce.name][lce.name]
            assert (chost['details']['registered_by'] ==
                    'Activation Key {}'.format(
                        repos_collection.setup_content_data['activation_key']
                        ['name']))
            assert chost['provisioning_details']['name'] == vm.hostname
            assert (
                chost['subscriptions']['resources']['assigned'][0]
                ['Repository Name'] == repos_collection.custom_product['name'])
            actual_repos = {
                repo['Repository Name']
                for repo in chost['repository_sets']['table']
            }
            expected_repos = {
                repo['name']
                for repo in repos_collection.custom_repos_info
            }
            assert actual_repos == expected_repos
            # Install package
            result = session.contenthost.execute_package_action(
                vm.hostname,
                'Package Install',
                FAKE_0_CUSTOM_PACKAGE_NAME,
            )
            assert result['result'] == 'success'
            # Ensure package installed
            packages = session.contenthost.search_package(
                vm.hostname, FAKE_0_CUSTOM_PACKAGE_NAME)
            assert packages[0]['Installed Package'] == FAKE_0_CUSTOM_PACKAGE
            # Install errata
            result = session.contenthost.install_errata(
                vm.hostname, FAKE_1_ERRATA_ID)
            assert result['result'] == 'success'
            # Ensure errata installed
            packages = session.contenthost.search_package(
                vm.hostname, FAKE_2_CUSTOM_PACKAGE_NAME)
            assert packages[0]['Installed Package'] == FAKE_2_CUSTOM_PACKAGE
            # Delete content host
            session.contenthost.delete(vm.hostname)
            assert not session.contenthost.search(vm.hostname)
Beispiel #34
0
def test_content_host_errata_page_pagination(session, org, lce):
    """
    # Test per-page pagination for BZ#1662254
    # Test apply by REX using Select All for BZ#1846670

    :id: 6363eda7-a162-4a4a-b70f-75decbd8202e

    :Steps:
        1. Install more than 20 packages that need errata
        2. View Content Host's Errata page
        3. Assert total_pages > 1
        4. Change per-page setting to 100
        5. Assert table has more than 20 errata
        6. Use the selection box on the left to select all on the page.
            The following is displayed at the top of the table:
            All 20 items on this page are selected. Select all YYY.

        7. Click the "Select all" text and assert more than 20 results are selected.
        8. Click the drop down arrow to the right of "Apply Selected", and select
            "via remote execution"
        9. Click Submit
        10. Assert Errata are applied as expected.

    :expectedresults: More than page of errata can be selected and applied using REX while
        changing per-page settings.


    :BZ: 1662254, 1846670

    :CaseLevel: System
    """
    pkgs = ' '.join(FAKE_3_YUM_OUTDATED_PACKAGES)
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=FAKE_3_YUM_REPO),
        ],
    )
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    with VMBroker(nick=repos_collection.distro,
                  host_classes={'host': ContentHost}) as client:
        # add_remote_execution_ssh_key for REX
        add_remote_execution_ssh_key(client.ip_addr)
        # Add repo and install packages that need errata
        repos_collection.setup_virtual_machine(client)
        assert _install_client_package(client, pkgs)
        with session:
            # Go to content host's Errata tab and read the page's pagination widgets
            session.organization.select(org_name=org.name)
            page_values = session.contenthost.read(
                client.hostname, widget_names=['errata.pagination'])
            assert int(page_values['errata']['pagination']['per_page']) == 20
            # assert total_pages > 1 with default page settings
            assert int(page_values['errata']['pagination']['pages']) > 1

            view = session.contenthost.navigate_to(session.contenthost,
                                                   'Edit',
                                                   entity_name=client.hostname)
            per_page_value = view.errata.pagination.per_page
            # Change per-page setting to 100 and assert there is now only one page
            assert per_page_value.fill('100')
            page_values = session.contenthost.read(
                client.hostname, widget_names=['errata.pagination'])
            assert int(page_values['errata']['pagination']['per_page']) == 100
            assert int(page_values['errata']['pagination']['pages']) == 1
            # assert at least the 28 errata from fake repo are present
            assert int(
                page_values['errata']['pagination']['total_items']) >= 28

            # install all errata using REX
            status = session.contenthost.install_errata(client.hostname,
                                                        'All',
                                                        install_via='rex')
            # Assert errata are listed on job invocation page
            assert status['overview']['job_status'] == 'Success'
            assert status['overview']['job_status_progress'] == '100%'
            # check that there are no applicable errata left on the CHost's errata page
            page_values = session.contenthost.read(
                client.hostname, widget_names=['errata.pagination'])
            assert int(page_values['errata']['pagination']['total_items']) == 0
Beispiel #35
0
def test_positive_filtered_errata_status_installable_param(session, errata_status_installable):
    """Filter errata for specific content view and verify that host that
    was registered using that content view has different states in
    correspondence to filtered errata and `errata status installable`
    settings flag value

    :id: ed94cf34-b8b9-4411-8edc-5e210ea6af4f

    :Steps:

        1. Prepare setup: Create Lifecycle Environment, Content View,
            Activation Key and all necessary repos
        2. Register Content Host using created data
        3. Create necessary Content View Filter and Rule for repository errata
        4. Publish and Promote Content View to a new version.
        5. Go to created Host page and check its properties
        6. Change 'errata status installable' flag in the settings and
            check host properties once more

    :expectedresults: Check that 'errata status installable' flag works as intended

    :BZ: 1368254

    :CaseLevel: System
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            RHELAnsibleEngineRepository(cdn=True),
            YumRepository(url=CUSTOM_REPO_URL),
        ]
    )
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    with VirtualMachine(distro=repos_collection.distro) as client:
        repos_collection.setup_virtual_machine(client)
        assert _install_client_package(client, FAKE_1_CUSTOM_PACKAGE, errata_applicability=True)
        # Adding content view filter and content view filter rule to exclude errata for the
        # installed package.
        content_view = entities.ContentView(
            id=repos_collection.setup_content_data['content_view']['id']).read()
        cv_filter = entities.ErratumContentViewFilter(
            content_view=content_view, inclusion=False).create()
        errata = entities.Errata(content_view_version=content_view.version[-1]).search(
            query=dict(search='errata_id="{0}"'.format(CUSTOM_REPO_ERRATA_ID)))[0]
        entities.ContentViewFilterRule(content_view_filter=cv_filter, errata=errata).create()
        content_view.publish()
        content_view = content_view.read()
        content_view_version = content_view.version[-1]
        promote(content_view_version, lce.id)
        with session:
            session.organization.select(org_name=org.name)
            _set_setting_value(errata_status_installable, True)
            expected_values = {
                'Status': 'OK',
                'Errata': 'All errata applied',
                'Subscription': 'Fully entitled',
            }
            host_details_values = session.host.get_details(client.hostname)
            actual_values = {
                key: value
                for key, value in host_details_values['properties']['properties_table'].items()
                if key in expected_values
            }
            assert actual_values == expected_values
            _set_setting_value(errata_status_installable, False)
            expected_values = {
                'Status': 'Error',
                'Errata': 'Security errata applicable',
                'Subscription': 'Fully entitled',
            }
            # navigate to host main page by making a search, to refresh the host details page
            session.host.search(client.hostname)
            host_details_values = session.host.get_details(client.hostname)
            actual_values = {
                key: value
                for key, value in host_details_values['properties']['properties_table'].items()
                if key in expected_values
            }
            assert actual_values == expected_values
Beispiel #36
0
def test_end_to_end(session):
    """Create all entities required for errata, set up applicable host,
    read errata details and apply it to host

    :id: a26182fc-f31a-493f-b094-3f5f8d2ece47

    :expectedresults: Errata details are the same as expected, errata
        installation is successful

    :CaseLevel: System
    """
    ERRATA_DETAILS = {
        'advisory':
        'RHEA-2012:0055',
        'cves':
        'N/A',
        'type':
        'Security Advisory',
        'severity':
        'N/A',
        'issued':
        '1/27/12',
        'last_updated_on':
        '1/27/12',
        'reboot_suggested':
        'No',
        'topic':
        '',
        'description':
        'Sea_Erratum',
        'solution':
        '',
        'affected_packages': [
            'penguin-0.9.1-1.noarch', 'shark-0.1-1.noarch',
            'walrus-5.21-1.noarch'
        ]
    }
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            YumRepository(url=CUSTOM_REPO_URL)
        ])
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    with VirtualMachine(distro=DISTRO_RHEL7) as client:
        repos_collection.setup_virtual_machine(client)
        assert client.subscribed
        client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE))
        with session:
            session.organization.select(org.name)
            errata = session.errata.read(CUSTOM_REPO_ERRATA_ID)
            assert errata['details'] == ERRATA_DETAILS
            assert (errata['repositories']['table'][0]['Name'] ==
                    repos_collection.custom_repos_info[-1]['name'])
            assert (errata['repositories']['table'][0]['Product'] ==
                    repos_collection.custom_product['name'])
            result = session.errata.install(CUSTOM_REPO_ERRATA_ID,
                                            client.hostname)
            assert result['result'] == 'success'
def test_positive_filtered_errata_status_installable_param(
        session, errata_status_installable):
    """Filter errata for specific content view and verify that host that
    was registered using that content view has different states in
    correspondence to filtered errata and `errata status installable`
    settings flag value

    :id: ed94cf34-b8b9-4411-8edc-5e210ea6af4f

    :Steps:

        1. Prepare setup: Create Lifecycle Environment, Content View,
            Activation Key and all necessary repos
        2. Register Content Host using created data
        3. Create necessary Content View Filter and Rule for repository errata
        4. Publish and Promote Content View to a new version.
        5. Go to created Host page and check its properties
        6. Change 'errata status installable' flag in the settings and
            check host properties once more

    :expectedresults: Check that 'errata status installable' flag works as intended

    :BZ: 1368254

    :CaseLevel: System
    """
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    repos_collection = RepositoryCollection(
        distro=DISTRO_RHEL7,
        repositories=[
            SatelliteToolsRepository(),
            # As Satellite Tools may be added as custom repo and to have a "Fully entitled" host,
            # force the host to consume an RH product with adding a cdn repo.
            RHELAnsibleEngineRepository(cdn=True),
            YumRepository(url=CUSTOM_REPO_URL),
        ],
    )
    repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
    with VirtualMachine(distro=repos_collection.distro) as client:
        repos_collection.setup_virtual_machine(client)
        assert _install_client_package(client,
                                       FAKE_1_CUSTOM_PACKAGE,
                                       errata_applicability=True)
        # Adding content view filter and content view filter rule to exclude errata for the
        # installed package.
        content_view = entities.ContentView(
            id=repos_collection.setup_content_data['content_view']
            ['id']).read()
        cv_filter = entities.ErratumContentViewFilter(
            content_view=content_view, inclusion=False).create()
        errata = entities.Errata(
            content_view_version=content_view.version[-1]).search(query=dict(
                search=f'errata_id="{CUSTOM_REPO_ERRATA_ID}"'))[0]
        entities.ContentViewFilterRule(content_view_filter=cv_filter,
                                       errata=errata).create()
        content_view.publish()
        content_view = content_view.read()
        content_view_version = content_view.version[-1]
        promote(content_view_version, lce.id)
        with session:
            session.organization.select(org_name=org.name)
            _set_setting_value(errata_status_installable, True)
            expected_values = {
                'Status': 'OK',
                'Errata': 'All errata applied',
                'Subscription': 'Fully entitled',
            }
            host_details_values = session.host.get_details(client.hostname)
            actual_values = {
                key: value
                for key, value in host_details_values['properties']
                ['properties_table'].items() if key in expected_values
            }
            for key in actual_values:
                assert expected_values[key] in actual_values[
                    key], 'Expected text not found'
            _set_setting_value(errata_status_installable, False)
            expected_values = {
                'Status': 'Error',
                'Errata': 'Security errata applicable',
                'Subscription': 'Fully entitled',
            }
            # navigate to host main page by making a search, to refresh the host details page
            session.host.search(client.hostname)
            host_details_values = session.host.get_details(client.hostname)
            actual_values = {
                key: value
                for key, value in host_details_values['properties']
                ['properties_table'].items() if key in expected_values
            }
            for key in actual_values:
                assert expected_values[key] in actual_values[
                    key], 'Expected text not found'
Beispiel #38
0
def test_positive_user_access_with_host_filter(test_name, module_loc,
                                               rhel7_contenthost):
    """Check if user with necessary host permissions can access dashboard
    and required widgets are rendered with proper values

    :id: 24b4b371-cba0-4bc8-bc6a-294c62e0586d

    :Steps:

        1. Specify proper filter with permission for your role
        2. Create new user and assign role to it
        3. Login into application using this new user
        4. Check dashboard and widgets on it
        5. Register new content host to populate some values into dashboard widgets

    :expectedresults: Dashboard and Errata Widget rendered without errors and
        contain proper values

    :BZ: 1417114

    :CaseLevel: System
    """
    user_login = gen_string('alpha')
    user_password = gen_string('alphanumeric')
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    # create a role with necessary permissions
    role = entities.Role().create()
    user_permissions = {
        'Organization': ['view_organizations'],
        'Location': ['view_locations'],
        None: ['access_dashboard'],
        'Host': ['view_hosts'],
    }
    create_role_permissions(role, user_permissions)
    # create a user and assign the above created role
    entities.User(
        default_organization=org,
        organization=[org],
        default_location=module_loc,
        location=[module_loc],
        role=[role],
        login=user_login,
        password=user_password,
    ).create()
    with Session(test_name, user=user_login,
                 password=user_password) as session:
        assert session.dashboard.read(
            'HostConfigurationStatus')['total_count'] == 0
        assert len(session.dashboard.read('LatestErrata')) == 0
        repos_collection = RepositoryCollection(
            distro=DISTRO_RHEL7,
            repositories=[
                SatelliteToolsRepository(),
                YumRepository(url=FAKE_6_YUM_REPO)
            ],
        )
        repos_collection.setup_content(org.id, lce.id, upload_manifest=True)
        repos_collection.setup_virtual_machine(rhel7_contenthost)
        result = rhel7_contenthost.run(
            f'yum install -y {FAKE_1_CUSTOM_PACKAGE}')
        assert result.status == 0
        hostname = rhel7_contenthost.hostname
        # Check UI for values
        assert session.host.search(hostname)[0]['Name'] == hostname
        hosts_values = session.dashboard.read('HostConfigurationStatus')
        assert hosts_values['total_count'] == 1
        errata_values = session.dashboard.read('LatestErrata')['erratas']
        assert len(errata_values) == 1
        assert errata_values[0]['Type'] == 'security'
        assert FAKE_2_ERRATA_ID in errata_values[0]['Errata']
Beispiel #39
0
def test_positive_user_access_with_host_filter(test_name, module_loc):
    """Check if user with necessary host permissions can access dashboard
    and required widgets are rendered with proper values

    :id: 24b4b371-cba0-4bc8-bc6a-294c62e0586d

    :Steps:

        1. Specify proper filter with permission for your role
        2. Create new user and assign role to it
        3. Login into application using this new user
        4. Check dashboard and widgets on it
        5. Register new content host to populate some values into dashboard widgets

    :expectedresults: Dashboard and Errata Widget rendered without errors and
        contain proper values

    :BZ: 1417114

    :CaseLevel: System
    """
    user_login = gen_string('alpha')
    user_password = gen_string('alphanumeric')
    org = entities.Organization().create()
    lce = entities.LifecycleEnvironment(organization=org).create()
    # create a role with necessary permissions
    role = entities.Role().create()
    user_permissions = {
        'Organization': ['view_organizations'],
        'Location': ['view_locations'],
        None: ['access_dashboard'],
        'Host': ['view_hosts'],
    }
    create_role_permissions(role, user_permissions)
    # create a user and assign the above created role
    entities.User(
        default_organization=org,
        organization=[org],
        default_location=module_loc,
        location=[module_loc],
        role=[role],
        login=user_login,
        password=user_password
    ).create()
    with Session(test_name, user=user_login, password=user_password) as session:
        assert session.dashboard.read('HostConfigurationStatus')['total_count'] == 0
        assert len(session.dashboard.read('LatestErrata')) == 0
        repos_collection = RepositoryCollection(
            distro=DISTRO_RHEL7,
            repositories=[
                SatelliteToolsRepository(),
                YumRepository(url=FAKE_6_YUM_REPO),
            ]
        )
        repos_collection.setup_content(org.id, lce.id)
        with VirtualMachine(distro=repos_collection.distro) as client:
            repos_collection.setup_virtual_machine(client)
            result = client.run('yum install -y {0}'.format(FAKE_1_CUSTOM_PACKAGE))
            assert result.return_code == 0
            hostname = client.hostname
            # Check UI for values
            assert session.host.search(hostname)[0]['Name'] == hostname
            hosts_values = session.dashboard.read('HostConfigurationStatus')
            assert hosts_values['total_count'] == 1
            errata_values = session.dashboard.read('LatestErrata')['erratas']
            assert len(errata_values) == 1
            assert errata_values[0]['Type'] == 'security'
            assert FAKE_2_ERRATA_ID in errata_values[0]['Errata']