Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_hosts(self):
with self.recorder:
self.assertIsInstance(self.tower.hosts, EntityManager)
host_generator = self.tower.get_hosts_by_name('example.com')
host = list(host_generator)[0]
self.assertIsInstance(host, Host)
self.assertTrue(host.name == self.tower.get_host_by_id(host.id).name)
other_host = self.tower.get_inventory_host_by_name('workflow', 'Test Inventory', 'example.com')
self.assertTrue(host.name == other_host.name)
with self.assertRaises(InvalidInventory):
self.tower.get_inventory_host_by_name('workflow', 'Test Inventory Broken', 'example.com')
def test_roles(self):
with self.recorder:
self.assertIsInstance(self.team.roles, EntityManager)
def test_credentials(self):
with self.recorder:
self.assertIsInstance(self.user.credentials, EntityManager)
def test_organizations(self):
with self.recorder:
self.assertIsInstance(self.user.organizations, EntityManager)
def custom_credential_types(self):
"""The custom credential_types configured in tower.
Returns:
EntityManager: The manager object for external credential types.
"""
return EntityManager(self,
entity_name='credential_types',
entity_object='CredentialType',
primary_match_field='name').filter({'managed_by_tower': 'false'})
def organizations(self):
"""The organizations configured in tower.
Returns:
EntityManager: The manager object for organizations.
"""
return EntityManager(self,
entity_name='organizations',
entity_object='Organization',
primary_match_field='name')
def notification_templates(self):
"""The notification templates configured in tower.
Returns:
EntityManager: The manager object for groups.
"""
return EntityManager(self,
entity_name='notification_templates',
entity_object='NotificationTemplate',
primary_match_field='name')
def hosts(self):
"""The hosts configured in tower.
Returns:
EntityManager: The manager object for hosts
"""
return EntityManager(self,
entity_name='hosts',
entity_object='Host',
primary_match_field='name')
def unified_jobs(self):
"""The unified jobs executed in tower.
Returns:
EntityManager: The manager object for unified jobs.
"""
return EntityManager(self,
entity_name='unified_jobs',
entity_object='Job',
primary_match_field='name')
def credentials(self):
"""The credentials configured in tower.
Returns:
EntityManager: The manager object for credentials.
"""
return EntityManager(self,
entity_name='credentials',
entity_object='Credential',
primary_match_field='name')