def test_positive_auto_attach_disabled_golden_ticket(
    module_org, golden_ticket_host_setup, rhel7_contenthost_class, default_sat
):
    """Verify that Auto-Attach is disabled or "Not Applicable"
    when a host organization is in Simple Content Access mode (Golden Ticket)

    :id: 668fae4d-7364-4167-967f-6fc31ba52d26

    :expectedresults: auto attaching a subscription is not allowed
        and returns an error message

    :customerscenario: true

    :BZ: 1718954

    :CaseImportance: Medium
    """
    rhel7_contenthost_class.install_katello_ca(default_sat)
    rhel7_contenthost_class.register_contenthost(module_org.label, golden_ticket_host_setup['name'])
    assert rhel7_contenthost_class.subscribed
    host = Host.list({'search': rhel7_contenthost_class.hostname})
    host_id = host[0]['id']
    with pytest.raises(CLIReturnCodeError) as context:
        Host.subscription_auto_attach({'host-id': host_id})
    assert "This host's organization is in Simple Content Access mode" in str(context.value)
Esempio n. 2
0
    def test_positive_auto_attach_disabled_golden_ticket(self):
        """Verify that Auto-Attach is disabled or "Not Applicable"
        when a host organization is in Simple Content Access mode (Golden Ticket)

        :id: 668fae4d-7364-4167-967f-6fc31ba52d26

        :expectedresults: auto attaching a subscription is not allowed
            and returns an error message

        :BZ: 1718954

        :CaseImportance: Medium
        """
        with VirtualMachine(distro=DISTRO_RHEL7) as vm:
            vm.install_katello_ca()
            vm.register_contenthost(self.org_setup['label'], self.ak_setup['name'])
            assert vm.subscribed
            host = Host.list({'search': vm.hostname})
            host_id = host[0]['id']
            with pytest.raises(CLIReturnCodeError) as context:
                Host.subscription_auto_attach({'host-id': host_id})
            assert 'Auto-attach is disabled' in str(context.value)