def test_positive_create_with_hosts_limit(self): """Create Discovery Rule providing any number from range 1..100 for hosts limit field :id: 64b90586-c1a9-4be4-8c44-4fa19ca998f8 :expectedresults: Rule should be successfully created and has expected hosts limit field value :CaseImportance: Critical """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, host_limit=limit, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit )
def test_negative_update_limit(self): """Update discovery rule host limit using invalid values :id: 7e8b7218-3c8a-4b03-b0df-484e0d793ceb :expectedresults: Rule host limit is not updated :CaseImportance: Critical """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, host_limit=limit, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_limit in '-1', gen_string('alpha'): with self.subTest(new_limit): self.discoveryrules.update(name=name, host_limit=new_limit) msg = self.discoveryrules.find_element( locators['discoveryrules.host_limit']).get_attribute( "validationMessage") if new_limit == '-1': self.assertEqual( msg, u'Please select a value that is no less than 0.') else: self.assertEqual(msg, u'Please enter a number.') self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit)
def test_positive_create_with_priority(self): """Create Discovery Rule providing any number from range 1..100 for priority field :id: de847288-257a-4f0e-9cb6-9a0dd0877d23 :expectedresults: Rule should be successfully created and has expected priority field value :CaseImportance: Critical """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, priority=priority, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority)
def test_negative_update_hostname(self): """Update discovery rule host name using number as a value @id: 18713425-22fe-4eaa-a515-8e08aa07e116 @Assert: Rule host name is not updated """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, hostname=hostname, ) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update( name=name, hostname=gen_string('numeric')) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['haserror'] )) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname )
def test_negative_create_with_same_name(self): """Create Discovery Rule with name that already exists :id: 5a914e76-de01-406d-9860-0e4e1521b074 :expectedresults: Error should be raised and rule should not be created :CaseImportance: Critical """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror']))
def test_negative_create_with_limit(self): """Create Discovery Rule with invalid host limit :id: 743d29f4-a901-400c-ad98-a3b8942f02b5 :expectedresults: Error should be raised and rule should not be created :CaseImportance: Critical """ name = gen_string('alpha') with Session(self.browser) as session: for limit in '-1', gen_string('alpha'): with self.subTest(limit): make_discoveryrule( session, name=name, host_limit=limit, hostgroup=self.host_group.name, ) msg = self.discoveryrules.find_element( locators['discoveryrules.host_limit']).get_attribute( "validationMessage") if limit == '-1': self.assertEqual( msg, u'Please select a value that is no less than 0.') else: self.assertEqual(msg, u'Please enter a number.') self.assertIsNone(self.discoveryrules.search(name))
def test_positive_create_with_search(self): """Create Discovery Rule using different search queries :id: 973ff6e5-572e-401c-bc8c-d614a583e883 :expectedresults: Rule should be successfully created and has expected search field value :CaseImportance: Critical """ with Session(self) as session: for query in valid_search_queries(): with self.subTest(query): name = gen_string('alpha') make_discoveryrule( session, name=name, hostgroup=self.host_group.name, search_rule=query, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'search'), query )
def test_positive_update_query(self): """Update discovery rule search query :id: bcf85a4c-0b27-47a5-8d5d-7ede0f6eea41 :expectedresults: Rule search field is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_query in valid_search_queries(): with self.subTest(new_query): self.discoveryrules.update(name=name, search_rule=new_query) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'search'), new_query)
def test_negative_update_priority(self): """Update discovery rule priority using invalid values @Feature: Discovery Rule - Update @Assert: Rule priority is not updated """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, priority=priority, ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_priority in '-1', gen_string('alpha'): with self.subTest(new_priority): self.discoveryrules.update(name=name, priority=new_priority) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror'])) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority)
def test_positive_update_hostgroup(self): """Update discovery rule host group :id: e10274e9-bf1b-42cd-a809-f19e707e7f4c :expectedresults: Rule host group is updated :CaseImportance: Critical """ name = gen_string('alpha') new_hostgroup_name = entities.HostGroup( organization=[self.session_org]).create().name with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostgroup', element_type='select'), self.host_group.name) self.discoveryrules.update(name=name, hostgroup=new_hostgroup_name) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostgroup', element_type='select'), new_hostgroup_name)
def test_negative_update_name(self): """Update discovery rule name using invalid names only :id: 65f32628-796a-4d7e-bf2c-c84c6b06f309 :expectedresults: Rule name is not updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_name in invalid_values_list(interface='ui'): with self.subTest(new_name): self.discoveryrules.update(name=name, new_name=new_name) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror'])) self.assertIsNone(self.discoveryrules.search(new_name))
def test_negative_update_hostname(self): """Update discovery rule host name using number as a value @Feature: Discovery Rule - Update @Assert: Rule host name is not updated """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, hostname=hostname, ) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, hostname=gen_string('numeric')) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror'])) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname)
def test_positive_update_hostgroup(self): """Update discovery rule host group @Feature: Discovery Rule - Update @Assert: Rule host group is updated """ name = gen_string('alpha') new_hostgroup_name = entities.HostGroup().create().name with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostgroup', element_type='select'), self.host_group.name) self.discoveryrules.update(name=name, hostgroup=new_hostgroup_name) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostgroup', element_type='select'), new_hostgroup_name)
def test_negative_update_hostname(self): """Update discovery rule host name using number as a value :id: 18713425-22fe-4eaa-a515-8e08aa07e116 :expectedresults: Rule host name is not updated :CaseImportance: Critical """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, hostname=hostname, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, hostname=gen_string('numeric')) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror'])) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname)
def test_positive_create_with_hostname(self): """Create Discovery Rule using valid hostname value :id: e6742ca5-1d41-4ba3-8f2c-2169db92485b :expectedresults: Rule should be successfully created and has expected hostname field value :CaseImportance: Critical """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, locations=[self.session_loc.name], hostgroup=self.host_group.name, hostname=hostname, ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname )
def test_positive_create_with_hosts_limit(self): """Create Discovery Rule providing any number from range 1..100 for hosts limit field :id: 64b90586-c1a9-4be4-8c44-4fa19ca998f8 :expectedresults: Rule should be successfully created and has expected hosts limit field value :CaseImportance: Critical """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, host_limit=limit, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit)
def test_negative_update_priority(self): """Update discovery rule priority using invalid values @id: d44ad49c-5d95-442f-a1b3-cd82dd8ffabf @Assert: Rule priority is not updated """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, priority=priority, ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_priority in '-1', gen_string('alpha'): with self.subTest(new_priority): self.discoveryrules.update( name=name, priority=new_priority) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror']) ) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority )
def test_positive_update_hostgroup(self): """Update discovery rule host group @id: e10274e9-bf1b-42cd-a809-f19e707e7f4c @Assert: Rule host group is updated """ name = gen_string('alpha') new_hostgroup_name = entities.HostGroup( organization=[self.session_org]).create().name with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'hostgroup', element_type='select'), self.host_group.name ) self.discoveryrules.update(name=name, hostgroup=new_hostgroup_name) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'hostgroup', element_type='select'), new_hostgroup_name )
def test_negative_create_with_limit(self): """Create Discovery Rule with invalid host limit :id: 743d29f4-a901-400c-ad98-a3b8942f02b5 :expectedresults: Error should be raised and rule should not be created :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: for limit in '-1', gen_string('alpha'): with self.subTest(limit): make_discoveryrule( session, name=name, host_limit=limit, hostgroup=self.host_group.name, ) msg = self.discoveryrules.find_element( locators['discoveryrules.host_limit'] ).get_attribute("validationMessage") if limit == '-1': self.assertEqual( msg, u'Please select a value that is no less than 0.' ) else: self.assertEqual(msg, u'Please enter a number.') self.assertIsNone(self.discoveryrules.search(name))
def test_positive_create_with_search(self): """Create Discovery Rule using different search queries :id: 973ff6e5-572e-401c-bc8c-d614a583e883 :expectedresults: Rule should be successfully created and has expected search field value :CaseImportance: Critical """ with Session(self.browser) as session: for query in valid_search_queries(): with self.subTest(query): name = gen_string('alpha') make_discoveryrule( session, name=name, hostgroup=self.host_group.name, search_rule=query, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'search'), query)
def test_positive_update_query(self): """Update discovery rule search query :id: bcf85a4c-0b27-47a5-8d5d-7ede0f6eea41 :expectedresults: Rule search field is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_query in valid_search_queries(): with self.subTest(new_query): self.discoveryrules.update( name=name, search_rule=new_query) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'search'), new_query )
def test_negative_create_with_same_name(self): """Create Discovery Rule with name that already exists :id: 5a914e76-de01-406d-9860-0e4e1521b074 :expectedresults: Error should be raised and rule should not be created :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['name_haserror'] ))
def test_positive_update_disable_enable(self): """Update discovery rule enabled state. (Disabled->Enabled) :id: 60d619e4-a039-4f9e-a16c-b05f0598e8fa :expectedresults: Rule enabled checkbox is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], enabled=False, ) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, enabled=True) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'enabled', element_type='checkbox'), True )
def test_positive_update_hostgroup(self): """Update discovery rule host group :id: e10274e9-bf1b-42cd-a809-f19e707e7f4c :expectedresults: Rule host group is updated :CaseImportance: Critical """ name = gen_string('alpha') new_hostgroup_name = entities.HostGroup( organization=[self.session_org]).create().name with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'hostgroup', element_type='select'), self.host_group.name ) self.discoveryrules.update(name=name, hostgroup=new_hostgroup_name) self.assertEqual( self.discoveryrules.get_attribute_value( name, 'hostgroup', element_type='select'), new_hostgroup_name )
def test_negative_update_limit(self): """Update discovery rule host limit using invalid values :id: 7e8b7218-3c8a-4b03-b0df-484e0d793ceb :expectedresults: Rule host limit is not updated :CaseImportance: Critical """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, host_limit=limit, ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_limit in '-1', gen_string('alpha'): with self.subTest(new_limit): self.discoveryrules.update(name=name, host_limit=new_limit) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror'])) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit)
def test_negative_update_priority(self): """Update discovery rule priority using invalid values :id: d44ad49c-5d95-442f-a1b3-cd82dd8ffabf :expectedresults: Rule priority is not updated :CaseImportance: Critical """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, priority=priority, ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_priority in '-1', gen_string('alpha'): with self.subTest(new_priority): self.discoveryrules.update(name=name, priority=new_priority) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror'])) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority)
def test_negative_update_name(self): """Update discovery rule name using invalid names only :id: 65f32628-796a-4d7e-bf2c-c84c6b06f309 :expectedresults: Rule name is not updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_name in invalid_values_list(interface='ui'): with self.subTest(new_name): self.discoveryrules.update(name=name, new_name=new_name) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror']) ) self.assertIsNone(self.discoveryrules.search(new_name))
def test_negative_update_hostname(self): """Update discovery rule host name using number as a value :id: 18713425-22fe-4eaa-a515-8e08aa07e116 :expectedresults: Rule host name is not updated :CaseImportance: Critical """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, hostname=hostname, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update( name=name, hostname=gen_string('numeric')) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['haserror'] )) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname )
def test_negative_update_limit(self): """Update discovery rule host limit using invalid values @id: 7e8b7218-3c8a-4b03-b0df-484e0d793ceb @Assert: Rule host limit is not updated """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, host_limit=limit, ) self.assertIsNotNone(self.discoveryrules.search(name)) for new_limit in '-1', gen_string('alpha'): with self.subTest(new_limit): self.discoveryrules.update( name=name, host_limit=new_limit) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['haserror']) ) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit )
def test_positive_create_with_priority(self): """Create Discovery Rule providing any number from range 1..100 for priority field :id: de847288-257a-4f0e-9cb6-9a0dd0877d23 :expectedresults: Rule should be successfully created and has expected priority field value :CaseImportance: Critical """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name, priority=priority, locations=[self.session_loc.name], ) self.assertIsNotNone(self.discoveryrules.search(name)) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority )
def test_positive_create_discovery_rule_1(self, name): """@Test: Create Discovery Rule @Feature: Foreman Discovery @Assert: Rule should be successfully created """ with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_disable(self): """@Test: Disable Discovery Rule while creation @Feature: Foreman Discovery @Assert: Rule should be disabled """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name, enable=True) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_create_with_name(self): """Create Discovery Rule using different names @id: afdf7000-4bd0-41ec-9773-96ff68e27b8d @Assert: Rule should be successfully created """ with Session(self.browser) as session: for name in valid_data_list(): with self.subTest(name): make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_create_discovery_rule_2(self): """@Test: Create Discovery Rule with 255 characters in name @Feature: Foreman Discovery @Assert: Rule should be successfully created """ name = gen_string('alpha', 255) with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_create_with_name(self): """@Test: Create Discovery Rule using different names @Feature: Foreman Discovery @Assert: Rule should be successfully created """ with Session(self.browser) as session: for name in valid_data_list(): with self.subTest(name): make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_create_discovery_rule_1(self): """@Test: Create Discovery Rule @Feature: Foreman Discovery @Assert: Rule should be successfully created """ with Session(self.browser) as session: for name in generate_strings_list(length=8): with self.subTest(name): make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name))
def test_positive_delete(self): """Delete existing Discovery Rule @id: fc5b714c-e5bc-4b0f-bc94-88e080318704 @Assert: Rule should be successfully deleted """ with Session(self.browser) as session: for name in valid_data_list(): with self.subTest(name): make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.delete(name)
def test_positive_provision_without_auto_provision(self): """Create a discovery rule and execute it when "auto_provisioning" flag set to 'false' :id: 25f5112b-7bbd-4bda-8d75-c43bd6390aa8 :Setup: Host should already be discovered :expectedresults: Host should not be rebooted automatically :CaseLevel: System """ try: # Disable flag to auto provision discovery_auto = entities.Setting().search( query={'search': 'name="discovery_auto"'})[0] default_discovery_auto = discovery_auto.value discovery_auto.value = 'False' discovery_auto.update(['value']) rule_name = gen_string('alpha') with Session(self) as session: session.nav.go_to_select_org(self.org_name) # Define a discovery rule make_discoveryrule( session, name=rule_name, host_limit=1, hostgroup=self.config_env['host_group'], search_rule='cpu_count = 1', locations=[self.loc.name], ) self.assertIsNotNone(self.discoveryrules.search(rule_name)) with LibvirtGuest() as pxe_host: host_name = pxe_host.guest_name self.assertTrue( self.discoveredhosts.waitfordiscoveredhost(host_name) ) self.assertIsNotNone( self.discoveredhosts.search(host_name)) # Check that host shouldn't list under all hosts self.assertIsNone(self.hosts.search( u'{0}.{1}'.format(host_name, self.config_env['domain']) )) # Check that host still listed under discovered hosts self.assertIsNotNone( self.discoveredhosts.search(host_name)) finally: # Revert the discovery_auto flag to default value discovery_auto.value = default_discovery_auto discovery_auto.update(['value'])
def test_positive_delete(self): """Delete existing Discovery Rule @id: fc5b714c-e5bc-4b0f-bc94-88e080318704 @Assert: Rule should be successfully deleted """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.delete(name)
def test_positive_delete(self): """Delete existing Discovery Rule @Feature: Foreman Discovery @Assert: Rule should be successfully deleted """ with Session(self.browser) as session: for name in valid_data_list(): with self.subTest(name): make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.delete(name)
def test_positive_delete(self): """Delete existing Discovery Rule @Feature: Foreman Discovery @Assert: Rule should be successfully deleted """ with Session(self.browser) as session: for name in valid_data_list(): with self.subTest(name): make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.delete(name)
def test_negative_create_discovery_rule_2(self, name): """@Test: Create Discovery Rule with blank and whitespace in name @Feature: Foreman Discovery @Assert: Error should be raised and rule should not be created """ with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['name_haserror'] )) self.assertIsNone(self.discoveryrules.search(name))
def test_negative_create_discovery_rule_3(self, limit): """@Test: Create Discovery Rule with invalid host limit @Feature: Foreman Discovery @Assert: Error should be raised and rule should not be created """ name = gen_string("alpha", 6) with Session(self.browser) as session: make_discoveryrule(session, name=name, host_limit=limit, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['haserror'] )) self.assertIsNone(self.discoveryrules.search(name))
def test_negative_create_with_invalid_priority(self): """@Test: Create Discovery Rule with invalid priority @Feature: Foreman Discovery @Assert: Error should be raised and rule should not be created """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name, priority=gen_string('alpha', 6)) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['haserror'] )) self.assertIsNone(self.discoveryrules.search(name))
def test_negative_create_discovery_rule_1(self): """@Test: Create Discovery Rule with 256 characters in name @Feature: Foreman Discovery @Assert: Error should be raised and rule should not be created """ name = gen_string('alpha', 256) with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['name_haserror'] )) self.assertIsNone(self.discoveryrules.search(name))
def test_positive_update_name(self): """Update discovery rule name @id: 16a79449-7200-492e-9ddb-65fc034e510d @Assert: Rule name is updated """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) for new_name in valid_data_list(): with self.subTest(new_name): self.discoveryrules.update(name=name, new_name=new_name) self.assertIsNotNone(self.discoveryrules.search(new_name)) name = new_name # for next iteration
def test_negative_create_with_same_name(self): """Create Discovery Rule with name that already exists @id: 5a914e76-de01-406d-9860-0e4e1521b074 @Assert: Error should be raised and rule should not be created """ name = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.wait_until_element( common_locators['name_haserror'] ))
def test_negative_create_with_invalid_name(self): """Create Discovery Rule with invalid names @id: 79d950dc-4ca1-407e-84ca-9092d1cba978 @Assert: Error should be raised and rule should not be created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone( self.discoveryrules.wait_until_element( common_locators['name_haserror']) ) self.assertIsNone(self.discoveryrules.search(name))
def test_positive_delete(self): """Delete existing Discovery Rule :id: fc5b714c-e5bc-4b0f-bc94-88e080318704 :expectedresults: Rule should be successfully deleted :CaseImportance: Critical """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.delete(name)
def test_positive_update_hostname(self): """Update discovery rule hostname value @Feature: Discovery Rule - Update @Assert: Rule host name is updated """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule(session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, hostname=hostname) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname)
def test_positive_update_hostname(self): """Update discovery rule hostname value @id: 753ff15b-da73-4fb3-87cd-14d504d8e882 @Assert: Rule host name is updated """ name = gen_string('alpha') hostname = gen_string('alpha') with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, hostname=hostname) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'hostname'), hostname )
def test_positive_update_limit(self): """Update discovery rule limit value @id: 69d59c34-407b-47d0-a2b8-46decb95ef47 @Assert: Rule host limit field is updated """ name = gen_string('alpha') limit = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, host_limit=limit) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'host_limit'), limit )
def test_positive_update_priority(self): """Update discovery rule priority value @id: be4de7a9-df8e-44ae-9910-7397341f6d07 @Assert: Rule priority is updated """ name = gen_string('alpha') priority = str(gen_integer(1, 100)) with Session(self.browser) as session: make_discoveryrule( session, name=name, hostgroup=self.host_group.name) self.assertIsNotNone(self.discoveryrules.search(name)) self.discoveryrules.update(name=name, priority=priority) self.assertEqual( self.discoveryrules.get_attribute_value(name, 'priority'), priority )
def test_positive_delete_rule_with_non_admin_user(self): """Delete rule with non-admin user by associating discovery_manager role :id: 7fa56bab-82d7-46c9-a4fa-c44ef173c703 :expectedresults: Rule should be deleted successfully. :CaseLevel: Integration """ with Session(self.browser, self.manager_user, self.manager_user_password) as session: name = gen_string('alpha') make_discoveryrule( session, name=name, hostgroup=self.host_group.name, ) self.discoveryrules.delete(name)
def test_positive_create_rule_with_non_admin_user(self): """Create rule with non-admin user by associating discovery_manager role :id: 6a03983b-363d-4646-b277-34af5f5abc55 :expectedresults: Rule should be created successfully. :CaseLevel: Integration """ with Session(self.browser, self.manager_user, self.manager_user_password) as session: name = gen_string('alpha') make_discoveryrule( session, name=name, hostgroup=self.host_group.name, ) self.assertIsNotNone(self.discoveryrules.search(name))