def test_remove_environment_1(self, testdata): """@test: Remove environment by using organization name & evironment name. @feature: Organizations dis-associate environment. @assert: environment is removed from Organization. """ env = testdata['name'] strategy, value = common_locators["entity_select"] strategy1, value1 = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) with Session(self.browser) as session: make_env(session, name=env) search = self.environment.search(env) self.assertIsNotNone(search) make_org(session, org_name=org_name, envs=[env], edit=True) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_env"]).click() element = session.nav.wait_until_element((strategy1, value1 % env)) # Item is listed in 'Selected Items' list and not 'All Items' list. self.assertIsNotNone(element) self.org.update(org_name, envs=[env]) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_env"]).click() element = session.nav.wait_until_element((strategy, value % env)) # Item is listed in 'All Items' list and not 'Selected Items' list. self.assertIsNotNone(element)
def test_positive_availability_for_hostgroup_in_multiple_orgs(self): """New environment that present in different organizations should be visible for any created hostgroup in these organizations :id: 07ff316e-16c2-493e-a987-73d59f8e81c7 :customerscenario: true :expectedresults: Environment can be used for any new hostgroup and any organization where it is present in :BZ: 543178 :CaseLevel: Integration :CaseImportance: High """ env_name = gen_string('alpha') orgs_names = [entities.Organization().create().name for _ in range(2)] with Session(self) as session: make_env(session, name=env_name, organizations=orgs_names) self.assertIsNotNone(self.environment.search(env_name)) for org in orgs_names: set_context(session, org=org) self.hostgroup.navigate_to_entity() self.hostgroup.click(locators['hostgroups.new']) self.hostgroup.assign_value( locators['hostgroups.puppet_environment'], env_name)
def test_positive_availability_for_host_in_multiple_orgs(self): """New environment that present in different organizations should be visible for any created host in these organizations :id: badcfdd8-48a2-4abf-bef0-d4ff5c0f4c87 :expectedresults: Environment can be used for any new host and any organization where it is present in :BZ: 543178 :CaseLevel: Integration :CaseImportance: High """ env_name = gen_string('alpha') orgs_names = [entities.Organization().create().name for _ in range(2)] with Session(self) as session: make_env(session, name=env_name, organizations=orgs_names) self.assertIsNotNone(self.environment.search(env_name)) self.hosts.navigate_to_entity() self.hosts.click(locators['host.new']) for org in orgs_names: self.hosts.assign_value(locators['host.organization'], org) self.hosts.assign_value( locators['host.puppet_environment'], env_name)
def test_positive_availability_for_host_in_multiple_orgs(self): """New environment that present in different organizations should be visible for any created host in these organizations :id: badcfdd8-48a2-4abf-bef0-d4ff5c0f4c87 :customerscenario: true :expectedresults: Environment can be used for any new host and any organization where it is present in :BZ: 543178 :CaseLevel: Integration :CaseImportance: High """ env_name = gen_string('alpha') orgs_names = [entities.Organization().create().name for _ in range(2)] with Session(self) as session: make_env(session, name=env_name, organizations=orgs_names) self.assertIsNotNone(self.environment.search(env_name)) self.hosts.navigate_to_entity() self.hosts.click(locators['host.new']) for org in orgs_names: self.hosts.assign_value(locators['host.organization'], org) self.hosts.assign_value(locators['host.puppet_environment'], env_name)
def test_positive_availability_for_hostgroup_in_multiple_orgs(self): """New environment that present in different organizations should be visible for any created hostgroup in these organizations :id: 07ff316e-16c2-493e-a987-73d59f8e81c7 :expectedresults: Environment can be used for any new hostgroup and any organization where it is present in :BZ: 543178 :CaseLevel: Integration :CaseImportance: High """ env_name = gen_string('alpha') orgs_names = [entities.Organization().create().name for _ in range(2)] with Session(self) as session: make_env(session, name=env_name, organizations=orgs_names) self.assertIsNotNone(self.environment.search(env_name)) for org in orgs_names: set_context(session, org=org) self.hostgroup.navigate_to_entity() self.hostgroup.click(locators['hostgroups.new']) self.hostgroup.assign_value( locators['hostgroups.puppet_environment'], env_name)
def test_remove_env(self, name): """@Test: Delete an environment @Feature: Environment - Positive Delete @Assert: Environment is deleted """ with Session(self.browser) as session: make_env(session, name=name) self.environment.delete(name)
def test_create_env_positive_2(self, name): """@Test: Create new environment with 255 chars @Feature: Environment - Positive Create @Assert: Environment is created """ with Session(self.browser) as session: make_env(session, name=name) search = self.environment.search(name) self.assertIsNotNone(search)
def test_positive_delete(self): """Delete an environment @id: 8572461e-2457-4a1c-bb63-78f49ce2d0fd @Assert: Environment is deleted """ with Session(self.browser) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.environment.delete(name)
def test_positive_create_with_name(self): """Create new environment @id: be8ee96a-29e4-4c64-9cae-78ab6aa483d7 @Assert: Environment is created """ with Session(self.browser) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.assertIsNotNone(self.environment.search(name))
def test_create_env_negative_1(self, name): """@Test: Create new environment with 256 chars @Feature: Environment - Negative Create @Assert: Environment is not created """ with Session(self.browser) as session: make_env(session, name=name) search = self.environment.search(name) self.assertIsNone(search)
def test_positive_delete(self): """Delete an environment @Feature: Environment - Positive Delete @Assert: Environment is deleted """ with Session(self.browser) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.environment.delete(name)
def test_positive_create_with_name(self): """Create new environment @Feature: Environment - Positive Create @Assert: Environment is created """ with Session(self.browser) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.assertIsNotNone(self.environment.search(name))
def test_create_env_negative_2(self, name): """@Test: Create new environment with blank and whitespace in name @Feature: Environment - Negative Create @Assert: Environment is not created """ with Session(self.browser) as session: make_env(session, name=name) error = session.nav.wait_until_element( common_locators["name_haserror"]) self.assertIsNotNone(error)
def test_create_env_positive_1(self, testdata): """@Test: Create new environment @Feature: Environment - Positive Create @Assert: Environment is created """ name = testdata['name'] with Session(self.browser) as session: make_env(session, name=name) search = self.environment.search(name) self.assertIsNotNone(search)
def test_positive_create_with_org(self): """Create new environment with organization :id: 96d0b49c-2f01-4912-b93b-d2f9e614fe8a :expectedresults: Environment is created :CaseImportance: High """ env_name = gen_string('alpha') org = entities.Organization().create() with Session(self) as session: make_env(session, name=env_name, organizations=[org.name]) self.assertIsNotNone(self.environment.search(env_name))
def test_positive_create_with_loc(self): """Create new environment with location :id: ac3f4498-5cba-4fe6-a296-776f009fb28c :expectedresults: Environment is created :CaseImportance: High """ env_name = gen_string('alpha') loc = entities.Location().create() with Session(self) as session: make_env(session, name=env_name, locations=[loc.name]) self.assertIsNotNone(self.environment.search(env_name))
def test_positive_create_with_name(self): """Create new environment :id: be8ee96a-29e4-4c64-9cae-78ab6aa483d7 :expectedresults: Environment is created :CaseImportance: Critical """ with Session(self) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.assertIsNotNone(self.environment.search(name))
def test_remove_env(self, name): """@Test: Delete an environment @Feature: Environment - Positive Delete @Assert: Environment is deleted """ with Session(self.browser) as session: make_env(session, name=name) self.environment.delete(name, really=True) notif = session.nav.wait_until_element( common_locators["notif.success"]) self.assertTrue(notif)
def test_positive_delete(self): """Delete an environment :id: 8572461e-2457-4a1c-bb63-78f49ce2d0fd :expectedresults: Environment is deleted :CaseImportance: Critical """ with Session(self) as session: for name in valid_environments_list(): with self.subTest(name): make_env(session, name=name) self.environment.delete(name, dropdown_present=True)
def test_create_env_negative(self, name): """@Test: Try to create environment and use whitespace, blank, tab symbol or too long string of different types as its name value @Feature: Environment - Negative Create @Assert: Environment is not created """ with Session(self.browser) as session: make_env(session, name=name) error = session.nav.wait_until_element( common_locators['name_haserror']) self.assertIsNotNone(error)
def test_positive_update(self): """Update an environment and associated OS @id: 4fd6aa68-c850-4fcd-8c9b-f88d6c0d1c2d @Assert: Environment is updated """ name = gen_string('alpha') with Session(self.browser) as session: make_env(session, name=name) for new_name in valid_environments_list(): with self.subTest(new_name): self.environment.update(name, new_name=new_name) self.assertIsNotNone(self.environment.search(new_name)) name = new_name # for next iteration
def test_positive_update(self): """@Test: Update an environment and associated OS @Feature: Environment - Positive Update @Assert: Environment is updated """ name = gen_string('alpha') with Session(self.browser) as session: make_env(session, name=name) for new_name in valid_environments_list(): with self.subTest(new_name): self.environment.update(name, new_name=new_name) self.assertIsNotNone(self.environment.search(new_name)) name = new_name # for next iteration
def test_update_env(self, new_name): """@Test: Update an environment and associated OS @Feature: Environment - Positive Update @Assert: Environment is updated @BZ: 1126033 """ name = gen_string('alpha') with Session(self.browser) as session: make_env(session, name=name) self.environment.update(name, new_name=new_name) search = self.environment.search(new_name) self.assertIsNotNone(search)
def test_negative_create(self): """Try to create environment and use whitespace, blank, tab symbol or too long string of different types as its name value @id: 51c7e300-5f59-4de8-bc55-1a75b03aa456 @Assert: Environment is not created """ with Session(self.browser) as session: for name in invalid_values_list(interface='ui'): with self.subTest(name): make_env(session, name=name) self.assertIsNotNone( session.nav.wait_until_element( common_locators['name_haserror']) )
def test_update_env(self, testdata): """@Test: Update an environment and associated OS @Feature: Environment - Positive Update @Assert: Environment is updated @BZ: 1126033 """ name = testdata['name'] new_name = testdata['new_name'] with Session(self.browser) as session: make_env(session, name=name) self.environment.update(name, new_name=new_name) search = self.environment.search(new_name) self.assertIsNotNone(search)
def test_positive_update(self): """Update an environment and associated OS :id: 4fd6aa68-c850-4fcd-8c9b-f88d6c0d1c2d :expectedresults: Environment is updated :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_env(session, name=name) for new_name in valid_environments_list(): with self.subTest(new_name): self.environment.update(name, new_name=new_name) self.assertIsNotNone(self.environment.search(new_name)) name = new_name # for next iteration
def test_positive_create_with_long_name(self): """Create new environment with 255 chars @id: 37a57326-debf-498f-96f8-8f9d518817aa @Assert: Environment is created """ # TODO: This test can be removed by adding the value # gen_string('alphanumeric', 255) to valid_env_names(). But since # valid_env_names() is being used by the delete tests too, this value # will fail since environment.delete() uses base.delete_entity() which # uses base.search_entity(). environment.search() specifically # overrides this logic to make longer strings searchable. Once the # UI search improvements are done, this problem should go away and at # that point, this test can be merged to the previous one. name = gen_string('alphanumeric', 255) with Session(self.browser) as session: make_env(session, name=name) self.assertIsNotNone(self.environment.search(name))
def test_add_environment_1(self, testdata): """ @test: Add environment by using organization name and evironment name. @feature: Organizations associate environment. @assert: environment is added. """ env = testdata['name'] strategy, value = common_locators["entity_deselect"] org_name = generate_string("alpha", 8) with Session(self.browser) as session: make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) make_env(session, name=env) search = self.environment.search(env) self.assertIsNotNone(search) self.org.update(org_name, new_envs=[env]) self.org.search(org_name).click() session.nav.wait_until_element( tab_locators["context.tab_env"]).click() element = session.nav.wait_until_element((strategy, value % env)) self.assertIsNotNone(element)