Skip to content

Commit

Permalink
Replace old method of registration with global registration in robottelo
Browse files Browse the repository at this point in the history
  • Loading branch information
shweta83 committed Feb 12, 2024
1 parent d9c5ea8 commit fa19c17
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 20 deletions.
32 changes: 15 additions & 17 deletions tests/foreman/cli/test_activationkey.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ def test_negative_create_with_usage_limit_with_not_integers(module_org, limit, m
@pytest.mark.tier3
@pytest.mark.parametrize('invalid_values', ['-1', '-500', 0])
def test_negative_create_with_usage_limit_with_invalid_integers(
module_org, invalid_values, module_target_sat
module_org, invalid_values, module_target_sat
):
"""Create Activation key with invalid integers Usage Limit
Expand Down Expand Up @@ -594,7 +594,7 @@ def test_negative_update_usage_limit(module_org, module_target_sat):
@pytest.mark.skip_if_not_set('clients')
@pytest.mark.tier3
@pytest.mark.upgrade
def test_positive_usage_limit(module_org, target_sat):
def test_positive_usage_limit(module_org, module_location, target_sat):
"""Test that Usage limit actually limits usage
:id: 00ded856-e939-4140-ac84-91b6a8643623
Expand Down Expand Up @@ -629,11 +629,9 @@ def test_positive_usage_limit(module_org, target_sat):
)
with Broker(nick='rhel7', host_class=ContentHost, _count=2) as clients:
vm1, vm2 = clients
vm1.install_katello_ca(target_sat)
vm1.register_contenthost(module_org.label, new_ak['name'])
vm1.register(module_org, module_location, new_ak['name'], target_sat)
assert vm1.subscribed
vm2.install_katello_ca(target_sat)
result = vm2.register_contenthost(module_org.label, new_ak['name'])
result = vm2.register(module_org, module_location, new_ak['name'], target_sat)
assert not vm2.subscribed
assert result.status == 70
assert len(result.stderr) > 0
Expand Down Expand Up @@ -757,7 +755,7 @@ def test_positive_add_custom_product(module_org, module_target_sat):
@pytest.mark.upgrade
@pytest.mark.skipif((not settings.robottelo.REPOS_HOSTING_URL), reason='Missing repos_hosting_url')
def test_positive_add_redhat_and_custom_products(
module_target_sat, function_entitlement_manifest_org
module_target_sat, function_entitlement_manifest_org
):
"""Test if RH/Custom product can be associated to Activation key
Expand Down Expand Up @@ -877,7 +875,7 @@ def test_positive_delete_subscription(function_entitlement_manifest_org, module_
@pytest.mark.skip_if_not_set('clients')
@pytest.mark.tier3
@pytest.mark.upgrade
def test_positive_update_aks_to_chost(module_org, rhel7_contenthost, target_sat):
def test_positive_update_aks_to_chost(module_org, module_location, rhel7_contenthost, target_sat):
"""Check if multiple Activation keys can be attached to a
Content host
Expand Down Expand Up @@ -905,9 +903,11 @@ def test_positive_update_aks_to_chost(module_org, rhel7_contenthost, target_sat)
)
for _ in range(2)
]
rhel7_contenthost.install_katello_ca(target_sat)
for i in range(2):
rhel7_contenthost.register_contenthost(module_org.label, new_aks[i]['name'])
rhel7_contenthost.register(org=module_org,
loc=module_location,
activation_keys=new_aks[i]['name'],
target=target_sat)
assert rhel7_contenthost.subscribed


Expand Down Expand Up @@ -1499,7 +1499,7 @@ def test_positive_remove_user(module_org, module_target_sat):
@pytest.mark.run_in_one_thread
@pytest.mark.tier3
def test_positive_view_subscriptions_by_non_admin_user(
module_entitlement_manifest_org, module_target_sat
module_entitlement_manifest_org, module_target_sat
):
"""Attempt to read activation key subscriptions by non admin user
Expand Down Expand Up @@ -1603,7 +1603,7 @@ def test_positive_view_subscriptions_by_non_admin_user(

@pytest.mark.skip_if_not_set('clients')
@pytest.mark.tier3
def test_positive_subscription_quantity_attached(function_org, rhel7_contenthost, target_sat):
def test_positive_subscription_quantity_attached(function_org, module_location, rhel7_contenthost, target_sat):
"""Check the Quantity and Attached fields of 'hammer activation-key subscriptions'
see https://bugzilla.redhat.com/show_bug.cgi?id=1633094
Expand Down Expand Up @@ -1644,8 +1644,7 @@ def test_positive_subscription_quantity_attached(function_org, rhel7_contenthost
)
subs = target_sat.cli.Subscription.list({'organization-id': org['id']}, per_page=False)
subs_lookup = {s['id']: s for s in subs}
rhel7_contenthost.install_katello_ca(target_sat)
rhel7_contenthost.register_contenthost(org['label'], activation_key=ak['name'])
rhel7_contenthost.register(org, module_location, ak['name'], target_sat)
assert rhel7_contenthost.subscribed

ak_subs = target_sat.cli.ActivationKey.subscriptions(
Expand All @@ -1662,7 +1661,7 @@ def test_positive_subscription_quantity_attached(function_org, rhel7_contenthost

@pytest.mark.skip_if_not_set('clients')
@pytest.mark.tier3
def test_positive_ak_with_custom_product_on_rhel6(module_org, rhel6_contenthost, target_sat):
def test_positive_ak_with_custom_product_on_rhel6(module_org, module_location ,rhel6_contenthost, target_sat):
"""Registering a rhel6 host using an ak with custom repos should not fail
:id: d02c2664-8034-4562-914a-3b68f0c35b32
Expand All @@ -1683,8 +1682,7 @@ def test_positive_ak_with_custom_product_on_rhel6(module_org, rhel6_contenthost,
{'url': settings.repos.yum_1.url, 'organization-id': module_org.id}
)
ak = target_sat.api.ActivationKey(id=entities_ids['activationkey-id']).read()
rhel6_contenthost.install_katello_ca(target_sat)
result = rhel6_contenthost.register_contenthost(module_org.label, activation_key=ak.name)
result = rhel6_contenthost.register(module_org.label, module_location, ak.name, target_sat)
assert 'The system has been registered with ID' in result.stdout


Expand Down
5 changes: 2 additions & 3 deletions tests/foreman/cli/test_subscription.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ def test_positive_candlepin_events_processed_by_STOMP():

@pytest.mark.tier2
def test_positive_auto_attach_disabled_golden_ticket(
module_org, golden_ticket_host_setup, rhel7_contenthost_class, target_sat
module_org, module_location, golden_ticket_host_setup, rhel7_contenthost_class, target_sat
):
"""Verify that Auto-Attach is disabled or "Not Applicable"
when a host organization is in Simple Content Access mode (Golden Ticket)
Expand All @@ -269,8 +269,7 @@ def test_positive_auto_attach_disabled_golden_ticket(
:CaseImportance: Medium
"""
rhel7_contenthost_class.install_katello_ca(target_sat)
rhel7_contenthost_class.register_contenthost(module_org.label, golden_ticket_host_setup['name'])
rhel7_contenthost_class.register(module_org, module_location, golden_ticket_host_setup['name'], target_sat)
assert rhel7_contenthost_class.subscribed
host = target_sat.cli.Host.list({'search': rhel7_contenthost_class.hostname})
host_id = host[0]['id']
Expand Down

0 comments on commit fa19c17

Please sign in to comment.