mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 15:36:04 -03:30
Fix up unit tests after tower to controller rename
This commit is contained in:
committed by
Shane McDonald
parent
b64c2d6861
commit
8c1bc97c2f
@@ -14,7 +14,7 @@ __all__ = [
|
|||||||
'STANDARD_INVENTORY_UPDATE_ENV',
|
'STANDARD_INVENTORY_UPDATE_ENV',
|
||||||
]
|
]
|
||||||
|
|
||||||
CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'tower', 'insights')
|
CLOUD_PROVIDERS = ('azure_rm', 'ec2', 'gce', 'vmware', 'openstack', 'rhv', 'satellite6', 'controller', 'insights')
|
||||||
PRIVILEGE_ESCALATION_METHODS = [
|
PRIVILEGE_ESCALATION_METHODS = [
|
||||||
('sudo', _('Sudo')),
|
('sudo', _('Sudo')),
|
||||||
('su', _('Su')),
|
('su', _('Su')),
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ class HostManager(models.Manager):
|
|||||||
- Only consider results that are unique
|
- Only consider results that are unique
|
||||||
- Return the count of this query
|
- Return the count of this query
|
||||||
"""
|
"""
|
||||||
return self.order_by().exclude(inventory_sources__source='tower').values('name').distinct().count()
|
return self.order_by().exclude(inventory_sources__source='controller').values('name').distinct().count()
|
||||||
|
|
||||||
def org_active_count(self, org_id):
|
def org_active_count(self, org_id):
|
||||||
"""Return count of active, unique hosts used by an organization.
|
"""Return count of active, unique hosts used by an organization.
|
||||||
@@ -45,7 +45,7 @@ class HostManager(models.Manager):
|
|||||||
- Only consider results that are unique
|
- Only consider results that are unique
|
||||||
- Return the count of this query
|
- Return the count of this query
|
||||||
"""
|
"""
|
||||||
return self.order_by().exclude(inventory_sources__source='tower').filter(inventory__organization=org_id).values('name').distinct().count()
|
return self.order_by().exclude(inventory_sources__source='controller').filter(inventory__organization=org_id).values('name').distinct().count()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
"""When the parent instance of the host query set has a `kind=smart` and a `host_filter`
|
"""When the parent instance of the host query set has a `kind=smart` and a `host_filter`
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ class TestActiveCount:
|
|||||||
|
|
||||||
def test_active_count_minus_tower(self, inventory):
|
def test_active_count_minus_tower(self, inventory):
|
||||||
inventory.hosts.create(name='locally-managed-host')
|
inventory.hosts.create(name='locally-managed-host')
|
||||||
source = inventory.inventory_sources.create(name='tower-source', source='tower')
|
source = inventory.inventory_sources.create(name='tower-source', source='controller')
|
||||||
source.hosts.create(name='remotely-managed-host', inventory=inventory)
|
source.hosts.create(name='remotely-managed-host', inventory=inventory)
|
||||||
assert Host.objects.active_count() == 1
|
assert Host.objects.active_count() == 1
|
||||||
|
|
||||||
@@ -210,7 +210,7 @@ class TestInventorySourceInjectors:
|
|||||||
('rhv', 'ovirt.ovirt.ovirt'),
|
('rhv', 'ovirt.ovirt.ovirt'),
|
||||||
('satellite6', 'theforeman.foreman.foreman'),
|
('satellite6', 'theforeman.foreman.foreman'),
|
||||||
('insights', 'redhatinsights.insights.insights'),
|
('insights', 'redhatinsights.insights.insights'),
|
||||||
('tower', 'awx.awx.tower'),
|
('controller', 'awx.awx.tower'),
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
def test_plugin_proper_names(self, source, proper_name):
|
def test_plugin_proper_names(self, source, proper_name):
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ def fake_credential_factory():
|
|||||||
for var in var_specs.keys():
|
for var in var_specs.keys():
|
||||||
inputs[var] = generate_fake_var(var_specs[var])
|
inputs[var] = generate_fake_var(var_specs[var])
|
||||||
|
|
||||||
if source == 'tower':
|
if source == 'controller':
|
||||||
inputs.pop('oauth_token') # mutually exclusive with user/pass
|
inputs.pop('oauth_token') # mutually exclusive with user/pass
|
||||||
|
|
||||||
return Credential.objects.create(credential_type=ct, inputs=inputs)
|
return Credential.objects.create(credential_type=ct, inputs=inputs)
|
||||||
|
|||||||
@@ -1778,8 +1778,8 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
def test_tower_source(self, verify, inventory_update, private_data_dir, mocker):
|
def test_tower_source(self, verify, inventory_update, private_data_dir, mocker):
|
||||||
task = tasks.RunInventoryUpdate()
|
task = tasks.RunInventoryUpdate()
|
||||||
task.instance = inventory_update
|
task.instance = inventory_update
|
||||||
tower = CredentialType.defaults['tower']()
|
tower = CredentialType.defaults['controller']()
|
||||||
inventory_update.source = 'tower'
|
inventory_update.source = 'controller'
|
||||||
inputs = {'host': 'https://tower.example.org', 'username': 'bob', 'password': 'secret', 'verify_ssl': verify}
|
inputs = {'host': 'https://tower.example.org', 'username': 'bob', 'password': 'secret', 'verify_ssl': verify}
|
||||||
|
|
||||||
def get_cred():
|
def get_cred():
|
||||||
@@ -1806,8 +1806,8 @@ class TestInventoryUpdateCredentials(TestJobExecution):
|
|||||||
def test_tower_source_ssl_verify_empty(self, inventory_update, private_data_dir, mocker):
|
def test_tower_source_ssl_verify_empty(self, inventory_update, private_data_dir, mocker):
|
||||||
task = tasks.RunInventoryUpdate()
|
task = tasks.RunInventoryUpdate()
|
||||||
task.instance = inventory_update
|
task.instance = inventory_update
|
||||||
tower = CredentialType.defaults['tower']()
|
tower = CredentialType.defaults['controller']()
|
||||||
inventory_update.source = 'tower'
|
inventory_update.source = 'controller'
|
||||||
inputs = {
|
inputs = {
|
||||||
'host': 'https://tower.example.org',
|
'host': 'https://tower.example.org',
|
||||||
'username': 'bob',
|
'username': 'bob',
|
||||||
|
|||||||
Reference in New Issue
Block a user