def test_positive_add_and_remove_hostgroups(module_org): """add and remove a hostgroup from an organization :id: 34e2c7c8-dc20-4709-a5a9-83c0dee9d84d :expectedresults: Hostgroups are handled as expected :BZ: 1395229 :steps: 1. add and remove hostgroup by name 2. add and remove hostgroup by id :CaseLevel: Integration """ hostgroups = [make_hostgroup() for _ in range(0, 2)] Org.add_hostgroup({'hostgroup-id': hostgroups[0]['id'], 'id': module_org.id}) Org.add_hostgroup({'hostgroup': hostgroups[1]['name'], 'name': module_org.name}) org_info = Org.info({'name': module_org.name}) assert hostgroups[0]['name'] in org_info['hostgroups'], "Failed to add hostgroup by id" assert hostgroups[1]['name'] in org_info['hostgroups'], "Failed to add hostgroup by name" Org.remove_hostgroup({'hostgroup-id': hostgroups[1]['id'], 'id': module_org.id}) Org.remove_hostgroup({'hostgroup': hostgroups[0]['name'], 'name': module_org.name}) org_info = Org.info({'id': module_org.id}) assert hostgroups[0]['name'] not in org_info['hostgroups'], "Failed to remove hostgroup by name" assert hostgroups[1]['name'] not in org_info['hostgroups'], "Failed to remove hostgroup by id"
def test_positive_add_hostgroup_by_name(self): """@Test: Add a hostgroup by its name @Feature: Organization @Assert: Hostgroup is added to the org """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], })
def test_positive_add_hostgroup_by_name(self): """Add a hostgroup to organization by its name @Feature: Organization @Assert: Hostgroup is added to the org """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], }) org = Org.info({'name': org['name']}) self.assertIn(hostgroup['name'], org['hostgroups'])
def test_positive_add_hostgroup_by_name(self): """Add a hostgroup to organization by its name @id: 9cb2ef26-a98a-43a4-977c-d97c82509508 @Assert: Hostgroup is added to the org @CaseLevel: Integration """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], }) org = Org.info({'name': org['name']}) self.assertIn(hostgroup['name'], org['hostgroups'])
def test_positive_add_hostgroup_by_id(self): """Add a hostgroup to organization by its ID @id: 4edbb371-fbb0-4918-b4ac-afa3ab30cee0 @Assert: Hostgroup is added to the org @CaseLevel: Integration """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup-id': hostgroup['id'], 'id': org['id'], }) org = Org.info({'id': org['id']}) self.assertIn(hostgroup['name'], org['hostgroups'])
def test_positive_remove_hostgroup_by_name(self): """@Test: Add a hostgroup and then remove it by its name @Feature: Organization @Assert: Hostgroup is removed from the org """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], }) Org.remove_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], })
def test_positive_add_and_remove_hostgroups(self): """add and remove a hostgroup from an organization :id: 34e2c7c8-dc20-4709-a5a9-83c0dee9d84d :expectedresults: Hostgroups are handled as expected :bz: 1395229 :steps: 1. add and remove hostgroup by name 2. add and remove hostgroup by id :CaseLevel: Integration """ org = make_org() hostgroup_a = make_hostgroup() hostgroup_b = make_hostgroup() Org.add_hostgroup({ 'hostgroup-id': hostgroup_a['id'], 'id': org['id'], }) Org.add_hostgroup({ 'hostgroup': hostgroup_b['name'], 'name': org['name'], }) org_info = Org.info({'name': org['name']}) self.assertIn(hostgroup_a['name'], org_info['hostgroups'], "Failed to add hostgroup by id") self.assertIn(hostgroup_b['name'], org_info['hostgroups'], "Failed to add hostgroup by name") Org.remove_hostgroup({ 'hostgroup-id': hostgroup_b['id'], 'id': org['id'], }) Org.remove_hostgroup({ 'hostgroup': hostgroup_a['name'], 'name': org['name'], }) org_info = Org.info({'id': org['id']}) self.assertNotIn(hostgroup_a['name'], org_info['hostgroups'], "Failed to remove hostgroup by name") self.assertNotIn(hostgroup_b['name'], org_info['hostgroups'], "Failed to remove hostgroup by id")
def test_positive_remove_hostgroup_by_id(self): """Remove a hostgroup from an organization by its ID @feature: Organization @assert: Hostgroup is removed from the org """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup-id': hostgroup['id'], 'id': org['id'], }) Org.remove_hostgroup({ 'hostgroup-id': hostgroup['id'], 'id': org['id'], }) org = Org.info({'id': org['id']}) self.assertNotIn(hostgroup['name'], org['hostgroups'])
def test_positive_remove_hostgroup_by_id(self): """Remove a hostgroup from an organization by its ID @id: 34e2c7c8-dc20-4709-a5a9-83c0dee9d84d @assert: Hostgroup is removed from the org @CaseLevel: Integration """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup-id': hostgroup['id'], 'id': org['id'], }) Org.remove_hostgroup({ 'hostgroup-id': hostgroup['id'], 'id': org['id'], }) org = Org.info({'id': org['id']}) self.assertNotIn(hostgroup['name'], org['hostgroups'])
def test_positive_remove_hostgroup_by_name(self): """Remove a hostgroup from an organization by its name @id: 8b2804c9-cefe-4a8a-b3a4-12ea131cdef0 @Assert: Hostgroup is removed from the organization @CaseLevel: Integration """ org = make_org() hostgroup = make_hostgroup() Org.add_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], }) Org.remove_hostgroup({ 'hostgroup': hostgroup['name'], 'name': org['name'], }) org = Org.info({'name': org['name']}) self.assertNotIn(hostgroup['name'], org['hostgroups'])