def test_positive_remove_lce(self): """Remove a lifecycle environment from organization @id: bfa9198e-6078-4f10-b79a-3d7f51b835fd @Assert: Lifecycle environment is removed from the org @CaseLevel: Integration """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] lc_env_attrs = { 'name': lc_env_name, 'organization-id': org_id, } # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(response[0]['name'], lc_env_name) # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searching for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(len(response), 0)
def test_positive_add_and_remove_lce(module_org): """Remove a lifecycle environment from organization :id: bfa9198e-6078-4f10-b79a-3d7f51b835fd :expectedresults: Lifecycle environment is handled as expected :steps: 1. create and add lce to org 2. remove lce from org :CaseLevel: Integration """ # Create a lifecycle environment. lc_env_name = make_lifecycle_environment({'organization-id': module_org.id})['name'] lc_env_attrs = {'name': lc_env_name, 'organization-id': module_org.id} # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) assert response[0]['name'] == lc_env_name # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searching for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) assert len(response) == 0
def test_positive_list_with_pagination(self): """Make sure lces list can be displayed with different items per page value :id: 28ecbc1f-bb5c-49df-a586-8cfdc0dd57df :BZ: 1368590 :expectedresults: `per-page` correctly sets amount of items displayed per page, different `per-page` values divide a list into correct number of pages :CaseImportance: Critical """ # Test different `per-page` values for per_page in (1, 5, 20): with self.subTest(per_page): # Verify the first page contains exactly the same items count # as `per-page` value lces = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'per-page': per_page, }) self.assertEqual(len(lces), per_page) # Verify pagination and total amount of pages by checking the # items count on the last page last_page = (self.lces_count / per_page + int(self.lces_count % per_page != 0)) lces = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'page': last_page, 'per-page': per_page, }) self.assertEqual( len(lces), self.lces_count % per_page or per_page)
def test_positive_list_all_with_per_page(self): """Attempt to list more than 20 lifecycle environment with per-page option. :id: 6e10fb0e-5e2c-45e6-85a8-0c853450257b :BZ: 1420503 :expectedresults: all the Lifecycle environments are listed """ org = make_org() lifecycle_environments_count = 25 per_page_count = lifecycle_environments_count + 5 env_base_name = gen_string('alpha') last_env_name = ENVIRONMENT env_names = [last_env_name] for env_index in range(lifecycle_environments_count): env_name = '{0}-{1}'.format(env_base_name, env_index) make_lifecycle_environment({ 'name': env_name, 'organization-id': org['id'], 'prior': last_env_name }) last_env_name = env_name env_names.append(env_name) lifecycle_environments = LifecycleEnvironment.list({ 'organization-id': org['id'], 'per_page': per_page_count }) self.assertEqual(len(lifecycle_environments), lifecycle_environments_count + 1) env_name_set = {env['name'] for env in lifecycle_environments} self.assertEqual(env_name_set, set(env_names))
def test_positive_list_with_pagination(self): """Make sure lces list can be displayed with different items per page value :id: 28ecbc1f-bb5c-49df-a586-8cfdc0dd57df :BZ: 1368590 :expectedresults: `per-page` correctly sets amount of items displayed per page, different `per-page` values divide a list into correct number of pages :CaseImportance: Critical """ # Test different `per-page` values for per_page in (1, 5, 20): with self.subTest(per_page): # Verify the first page contains exactly the same items count # as `per-page` value lces = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'per-page': per_page, }) self.assertEqual(len(lces), per_page) # Verify pagination and total amount of pages by checking the # items count on the last page last_page = (self.lces_count / per_page + int(self.lces_count % per_page != 0)) lces = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'page': last_page, 'per-page': per_page, }) self.assertEqual(len(lces), self.lces_count % per_page or per_page)
def test_positive_remove_lce(self): """@Test: Add a lifecycle environment and then remove it @Feature: Organization @Assert: Lifecycle environment is removed from the org """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] lc_env_attrs = { 'name': lc_env_name, 'organization-id': org_id, } # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(response[0]['name'], lc_env_name) # Delete it. LifecycleEnvironment.delete(lc_env_attrs) # We should get a zero-length response when searcing for the LC env. response = LifecycleEnvironment.list(lc_env_attrs) self.assertEqual(len(response), 0)
def test_positive_add_lce(self): """Add a lifecycle environment to organization @Feature: Organization @Assert: Lifecycle environment is added to the org """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list({ 'name': lc_env_name, 'organization-id': org_id, }) self.assertEqual(response[0]['name'], lc_env_name)
def test_positive_add_lce(self): """Add a lifecycle environment to organization @id: 3620eeac-bf4e-4055-a6b4-4da10efbbfa2 @Assert: Lifecycle environment is added to the org @CaseLevel: Integration """ # Create a lifecycle environment. org_id = make_org()['id'] lc_env_name = make_lifecycle_environment( {'organization-id': org_id})['name'] # Read back information about the lifecycle environment. Verify the # sanity of that information. response = LifecycleEnvironment.list({ 'name': lc_env_name, 'organization-id': org_id, }) self.assertEqual(response[0]['name'], lc_env_name)
def test_positive_list_all_with_per_page(self): """Attempt to list more than 20 lifecycle environment with per-page option. :id: 6e10fb0e-5e2c-45e6-85a8-0c853450257b :BZ: 1420503 :expectedresults: all the Lifecycle environments are listed :CaseImportance: Critical """ per_page_count = self.lces_count + 5 lifecycle_environments = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'per-page': per_page_count }) self.assertEqual(len(lifecycle_environments), self.lces_count) env_name_set = {env['name'] for env in lifecycle_environments} self.assertEqual(env_name_set, set(self.env_names))
def test_positive_list_all_with_per_page(self): """Attempt to list more than 20 lifecycle environment with per-page option. :id: 6e10fb0e-5e2c-45e6-85a8-0c853450257b :BZ: 1420503 :expectedresults: all the Lifecycle environments are listed """ per_page_count = self.lces_count + 5 lifecycle_environments = LifecycleEnvironment.list({ 'organization-id': self.org['id'], 'per-page': per_page_count }) self.assertEqual(len(lifecycle_environments), self.lces_count) env_name_set = {env['name'] for env in lifecycle_environments} self.assertEqual(env_name_set, set(self.env_names))