def test_positive_env_list_fits_browser_screen(self): """Check if long list of lifecycle environments fits into screen :id: 63b985b0-c847-11e6-92ad-68f72889dc7f :Setup: save 8+ chained lifecycles environments :BZ: 1295922 :expectedresults: lifecycle environments table fits screen :CaseImportance: Critical """ with Session(self.browser) as session: env_names = [gen_string('alpha') for _ in range(11)] for name, prior in zip(env_names, chain([None], env_names)): make_lifecycle_environment(session, org=self.org_name, name=name, prior=prior) envs_table = session.nav.wait_until_element( locator=locators['content_env.table']) table_width = envs_table.size['width'] body = session.nav.find_element(common_locators['body']) body_width = body.size['width'] self.assertGreaterEqual(body_width - table_width, 0)
def test_positive_create_chain(self): """Create Content Environment in a chain :id: ed3d2c88-ef0a-4a1a-9f11-5bdb2119fc18 :expectedresults: Environment is created :CaseLevel: Integration """ env1_name = gen_string('alpha') env2_name = gen_string('alpha') description = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=env1_name, description=description ) self.assertIsNotNone(self.lifecycleenvironment.search(env1_name)) make_lifecycle_environment( session, org=self.org_name, name=env2_name, description=description, prior=env1_name, ) self.assertIsNotNone(self.lifecycleenvironment.search(env2_name))
def test_positive_delete_bz1225588(self, org_name): """@test: Create Organization with valid values and upload manifest. Then try to delete that organization. @feature: Organization Positive Delete Test. @assert: Organization is deleted successfully. """ org = entities.Organization(name=org_name).create() with open(manifests.clone(), 'rb') as manifest: upload_manifest(org.id, manifest) with Session(self.browser) as session: make_lifecycle_environment(session, org_name, name='DEV') make_lifecycle_environment( session, org_name, name='QE', prior='DEV' ) # Org cannot be deleted when selected, # So switching to Default Org and then deleting. session.nav.go_to_select_org('Default Organization') self.org.remove(org_name) session.nav.go_to_dashboard() status = self.org.search(org_name) # Check for at least ten times that org is deleted due #1225588 for _ in range(10): status = self.org.search(org_name) if status is None: break self.assertIsNone(status)
def test_cv_publish_custom_content(self): """@test: attempt to publish a content view containing custom content @feature: Content Views @setup: Multiple environments for an org; custom content synced @assert: Content view can be published """ repo_name = gen_string("alpha", 8) env_name = gen_string("alpha", 8) cv_name = gen_string("alpha", 8) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env_name) self.assertIsNotNone( session.nav.wait_until_element((strategy, value % env_name))) self.setup_to_create_cv(repo_name=repo_name) # Create content-view make_contentview(session, org=self.org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [repo_name]) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) self.content_views.publish(cv_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"]))
def test_positive_create_chain(self): """Create Content Environment in a chain :id: ed3d2c88-ef0a-4a1a-9f11-5bdb2119fc18 :expectedresults: Environment is created :CaseLevel: Integration """ env1_name = gen_string('alpha') env2_name = gen_string('alpha') description = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env1_name, description=description) self.assertIsNotNone(self.lifecycleenvironment.search(env1_name)) make_lifecycle_environment( session, org=self.org_name, name=env2_name, description=description, prior=env1_name, ) self.assertIsNotNone(self.lifecycleenvironment.search(env2_name))
def test_positive_create_chain(self): """Create Content Environment in a chain @Feature: Content Environment - Positive Create @Assert: Environment is created """ env1_name = gen_string('alpha') env2_name = gen_string('alpha') description = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=env1_name, description=description ) self.assertIsNotNone(self.lifecycleenvironment.search(env1_name)) make_lifecycle_environment( session, org=self.org_name, name=env2_name, description=description, prior=env1_name, ) self.assertIsNotNone(self.lifecycleenvironment.search(env2_name))
def test_positive_env_list_fits_browser_screen(self): """Check if long list of lifecycle environments fits into screen :id: 63b985b0-c847-11e6-92ad-68f72889dc7f :Setup: save 8+ chained lifecycles environments :BZ: 1295922 :expectedresults: lifecycle environments table fits screen :CaseImportance: Critical """ with Session(self.browser) as session: env_names = [gen_string('alpha') for _ in range(11)] for name, prior in zip(env_names, chain([None], env_names)): make_lifecycle_environment( session, org=self.org_name, name=name, prior=prior ) envs_table = session.nav.wait_until_element( locator=locators['content_env.table'] ) table_width = envs_table.size['width'] body = session.nav.find_element(common_locators['body']) body_width = body.size['width'] self.assertGreaterEqual(body_width - table_width, 0)
def test_verify_bugzilla_1225588(self): """Create Organization with valid values and upload manifest. Then try to delete that organization. :id: 851c8557-a406-4a70-9c8b-94bcf0482f8d :expectedresults: Organization is deleted successfully. :CaseLevel: Integration :CaseImportance: Critical """ org_name = gen_string('alphanumeric') org = entities.Organization(name=org_name).create() with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) with Session(self) as session: make_lifecycle_environment(session, org_name, name='DEV') make_lifecycle_environment( session, org_name, name='QE', prior='DEV' ) # Org cannot be deleted when selected, # So switching to Default Org and then deleting. session.nav.go_to_select_org('Default Organization') self.org.delete(org_name, dropdown_present=True) for _ in range(10): status = self.org.search(org_name) if status is None: break self.assertIsNone(status)
def test_cv_publish_custom_content(self): """@test: attempt to publish a content view containing custom content @feature: Content Views @setup: Multiple environments for an org; custom content synced @assert: Content view can be published """ repo_name = gen_string('alpha') env_name = gen_string('alpha') cv_name = gen_string('alpha') strategy, value = locators['content_env.select_name'] with Session(self.browser) as session: make_lifecycle_environment( session, org=self.organization.name, name=env_name) self.assertIsNotNone(session.nav.wait_until_element( (strategy, value % env_name))) self.setup_to_create_cv(repo_name=repo_name) # Create content-view make_contentview(session, org=self.organization.name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [repo_name]) self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'])) self.content_views.publish(cv_name) self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success']))
def test_cv_publish_custom_content(self): """@test: attempt to publish a content view containing custom content @feature: Content Views @setup: Multiple environments for an org; custom content synced @assert: Content view can be published """ repo_name = generate_string("alpha", 8) env_name = generate_string("alpha", 8) name = generate_string("alpha", 8) with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env_name) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"])) self.setup_to_create_cv(session, name, repo_name) self.content_views.add_remove_repos(name, [repo_name]) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.publish(name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"]))
def test_verify_bugzilla_1225588(self): """Create Organization with valid values and upload manifest. Then try to delete that organization. @feature: Organization Positive Delete Test. @assert: Organization is deleted successfully. """ org_name = gen_string('alphanumeric') org = entities.Organization(name=org_name).create() with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) with Session(self.browser) as session: make_lifecycle_environment(session, org_name, name='DEV') make_lifecycle_environment(session, org_name, name='QE', prior='DEV') # Org cannot be deleted when selected, # So switching to Default Org and then deleting. session.nav.go_to_select_org('Default Organization') self.org.delete(org_name) for _ in range(10): status = self.org.search(org_name) if status is None: break self.assertIsNone(status)
def test_positive_create_content_environment_chain(self): """@Test: Create Content Environment in a chain @Feature: Content Environment - Positive Create @Assert: Environment is created """ env1_name = gen_string('alpha') env2_name = gen_string('alpha') description = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=env1_name, description=description ) self.assertIsNotNone(self.contentenv.search(env1_name)) make_lifecycle_environment( session, org=self.org_name, name=env2_name, description=description, prior=env1_name, ) self.assertIsNotNone(self.contentenv.search(env2_name))
def test_verify_bugzilla_1225588(self): """Create Organization with valid values and upload manifest. Then try to delete that organization. @feature: Organization Positive Delete Test. @assert: Organization is deleted successfully. """ org_name = gen_string('alphanumeric') org = entities.Organization(name=org_name).create() with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) with Session(self.browser) as session: make_lifecycle_environment(session, org_name, name='DEV') make_lifecycle_environment( session, org_name, name='QE', prior='DEV' ) # Org cannot be deleted when selected, # So switching to Default Org and then deleting. session.nav.go_to_select_org('Default Organization') self.org.delete(org_name) for _ in range(10): status = self.org.search(org_name) if status is None: break self.assertIsNone(status)
def test_verify_bugzilla_1225588(self): """Create Organization with valid values and upload manifest. Then try to delete that organization. :id: 851c8557-a406-4a70-9c8b-94bcf0482f8d :expectedresults: Organization is deleted successfully. :CaseLevel: Integration :CaseImportance: Critical """ org_name = gen_string('alphanumeric') org = entities.Organization(name=org_name).create() with manifests.clone() as manifest: upload_manifest(org.id, manifest.content) with Session(self.browser) as session: make_lifecycle_environment(session, org_name, name='DEV') make_lifecycle_environment(session, org_name, name='QE', prior='DEV') # Org cannot be deleted when selected, # So switching to Default Org and then deleting. session.nav.go_to_select_org('Default Organization') self.org.delete(org_name, dropdown_present=True) for _ in range(10): status = self.org.search(org_name) if status is None: break self.assertIsNone(status)
def test_positive_create(self): """Create content environment with minimal input parameters @id: 2c3a9c4c-3508-4d75-8f60-8bc6f7c0717f @Assert: Environment is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_lifecycle_environment(session, org=self.org_name, name=name, description=gen_string("alpha")) self.assertIsNotNone(self.lifecycleenvironment.search(name))
def test_positive_delete(self): """Create Content Environment and delete it @id: fe2d9b10-fc46-47e3-827c-6f87d725ed8f @Assert: Environment is deleted """ name = gen_string("alpha") with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=gen_string("alpha")) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.delete(name) self.assertIsNone(self.lifecycleenvironment.search(name))
def test_cv_promote_rh_1(self): """@test: attempt to promote a content view containing RH content @feature: Content Views @setup: Multiple environments for an org; RH content synced @assert: Content view can be promoted """ cv_name = gen_string("alpha", 8) rh_repo = { 'name': ("Red Hat Enterprise Linux 6 Server " "- RH Common RPMs x86_64 6.3"), 'product': "Red Hat Enterprise Linux Server", 'reposet': ("Red Hat Enterprise Linux 6 Server " "- RH Common (RPMs)"), 'basearch': "x86_64", 'releasever': "6.3" } env_name = gen_string("alpha", 8) publish_version = "Version 1" strategy, value = locators["content_env.select_name"] # Create new org to import manifest org_attrs = entities.Organization().create() org_id = org_attrs['id'] org_name = org_attrs['name'] with Session(self.browser) as session: make_lifecycle_environment(session, org=org_name, name=env_name) self.assertIsNotNone( session.nav.wait_until_element((strategy, value % env_name))) self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id) # Create content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [rh_repo['name']]) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) self.content_views.publish(cv_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) self.content_views.promote(cv_name, publish_version, env_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"]))
def test_positive_update(self): """Create Content Environment and update it @id: 5cf64c5b-2105-4384-8630-965d9b8e3024 @Assert: Environment is updated """ name = gen_string("alpha") new_name = gen_string("alpha") with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.update(name, new_name, gen_string("alpha")) self.assertIsNotNone(self.lifecycleenvironment.search(new_name))
def test_cv_end_2_end(self): """@test: create content view with yum repo, publish it and promote it to Library +1 env @feature: Content Views @steps: 1. Create Product/repo and Sync it 2. Create CV and add created repo in step1 3. Publish and promote it to 'Library' 4. Promote it to next environment @assert: content view is created, updated with repo publish and promoted to next selected env """ repo_name = gen_string("alpha", 8) env_name = gen_string("alpha", 8) cv_name = gen_string("alpha", 8) publish_version = "Version 1" strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: # Create Life-cycle environment make_lifecycle_environment(session, org=self.org_name, name=env_name) self.assertIsNotNone( session.nav.wait_until_element((strategy, value % env_name))) # Creates a CV along with product and sync'ed repository self.setup_to_create_cv(repo_name=repo_name) # Create content-view make_contentview(session, org=self.org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add repository to selected CV self.content_views.add_remove_repos(cv_name, [repo_name]) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Publish and promote CV to next environment self.content_views.publish(cv_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) self.content_views.promote(cv_name, publish_version, env_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"]))
def test_positive_create_content_environment_1(self): """@Test: Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ name = generate_string("alpha", 6) description = generate_string("alpha", 6) with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"]))
def test_positive_create_content_environment_1(self): """@Test: Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % name)))
def test_positive_update_content_environment(self): """@Test: Create Content Environment and update it @Feature: Content Environment - Positive Update @Assert: Environment is updated """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name) self.assertIsNotNone(self.contentenv.search(name)) self.contentenv.update(name, new_name, gen_string('alpha')) self.assertIsNotNone(self.contentenv.search(new_name))
def test_positive_update(self): """Create Content Environment and update it :id: 5cf64c5b-2105-4384-8630-965d9b8e3024 :expectedresults: Environment is updated :CaseImportance: Critical """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.update(name, new_name, gen_string('alpha')) self.assertIsNotNone(self.lifecycleenvironment.search(new_name))
def test_cv_promote_rh_1(self): """@test: attempt to promote a content view containing RH content @feature: Content Views @setup: Multiple environments for an org; RH content synced @assert: Content view can be promoted """ cv_name = gen_string("alpha", 8) rh_repo = { 'name': ("Red Hat Enterprise Linux 6 Server " "- RH Common RPMs x86_64 6.3"), 'product': "Red Hat Enterprise Linux Server", 'reposet': ("Red Hat Enterprise Linux 6 Server " "- RH Common (RPMs)"), 'basearch': "x86_64", 'releasever': "6.3" } env_name = gen_string("alpha", 8) publish_version = "Version 1" strategy, value = locators["content_env.select_name"] # Create new org to import manifest org_attrs = entities.Organization().create_json() org_id = org_attrs['id'] org_name = org_attrs['name'] with Session(self.browser) as session: make_lifecycle_environment(session, org=org_name, name=env_name) self.assertIsNotNone(session.nav.wait_until_element ((strategy, value % env_name))) self.setup_to_create_cv(rh_repo=rh_repo, org_id=org_id) # Create content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [rh_repo['name']]) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.publish(cv_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.promote(cv_name, publish_version, env_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"]))
def test_positive_delete(self): """Create Content Environment and delete it @id: fe2d9b10-fc46-47e3-827c-6f87d725ed8f @Assert: Environment is deleted """ name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.delete(name) self.assertIsNone(self.lifecycleenvironment.search(name))
def test_positive_create_content_environment_1(self): """@Test: Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=description) self.assertIsNotNone( self.contentenv.wait_until_element((strategy, value % name)))
def test_positive_create_content_environment_basic(self): """@Test: Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone(self.contentenv.search(name))
def test_positive_create(self): """Create content environment with minimal input parameters @Feature: Content Environment - Positive Create @Assert: Environment is created """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone( self.lifecycleenvironment.search(name))
def test_positive_delete(self): """Create Content Environment and delete it @Feature: Content Environment - Positive Delete @Assert: Environment is deleted """ name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.delete(name) self.assertIsNone(self.lifecycleenvironment.search(name))
def test_cv_end_2_end(self): """@test: create content view with yum repo, publish it and promote it to Library +1 env @feature: Content Views @steps: 1. Create Product/repo and Sync it 2. Create CV and add created repo in step1 3. Publish and promote it to 'Library' 4. Promote it to next environment @assert: content view is created, updated with repo publish and promoted to next selected env """ repo_name = gen_string("alpha", 8) env_name = gen_string("alpha", 8) cv_name = gen_string("alpha", 8) publish_version = "Version 1" strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: # Create Life-cycle environment make_lifecycle_environment(session, org=self.org_name, name=env_name) self.assertIsNotNone(session.nav.wait_until_element ((strategy, value % env_name))) # Creates a CV along with product and sync'ed repository self.setup_to_create_cv(repo_name=repo_name) # Create content-view make_contentview(session, org=self.org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add repository to selected CV self.content_views.add_remove_repos(cv_name, [repo_name]) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) # Publish and promote CV to next environment self.content_views.publish(cv_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.promote(cv_name, publish_version, env_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"]))
def test_positive_update(self): """Create Content Environment and update it @Feature: Content Environment - Positive Update @Assert: Environment is updated """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.update( name, new_name, gen_string('alpha') ) self.assertIsNotNone(self.lifecycleenvironment.search(new_name))
def test_positive_add_puppet_module(self): """Promote content view with puppet module to a new environment :id: 12bed99d-8f96-48ca-843a-b77e123e8e2e :steps: 1. Create Product/puppet repo and sync it 2. Create CV and add puppet module from created repo 3. Publish and promote CV to new environment :expectedresults: Puppet modules can be listed successfully from lifecycle environment interface :BZ: 1408264 :CaseLevel: Integration """ cv_name = gen_string('alpha') env_name = gen_string('alpha') puppet_module = 'httpd' product = entities.Product(organization=self.organization).create() repo_id = entities.Repository(product=product, content_type=REPO_TYPE['puppet'], url=FAKE_0_PUPPET_REPO).create().id entities.Repository(id=repo_id).sync() with Session(self) as session: make_lifecycle_environment(session, org=self.organization.name, name=env_name) # Create content-view make_contentview(session, org=self.organization.name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_puppet_module( cv_name, puppet_module, filter_term='Latest', ) self.content_views.publish(cv_name) self.content_views.promote(cv_name, 'Version 1', env_name) self.assertIsNotNone( self.lifecycleenvironment.fetch_puppet_module(env_name, puppet_module, cv_name=cv_name))
def test_positive_delete_content_environment_1(self): """@Test: Create Content Environment and delete it @Feature: Content Environment - Positive Delete @Assert: Environment is deleted """ name = generate_string("alpha", 6) description = generate_string("alpha", 6) with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"])) self.contentenv.delete(name, "true") self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"]))
def test_positive_add_puppet_module(self): """Promote content view with puppet module to a new environment :id: 12bed99d-8f96-48ca-843a-b77e123e8e2e :steps: 1. Create Product/puppet repo and sync it 2. Create CV and add puppet module from created repo 3. Publish and promote CV to new environment :expectedresults: Puppet modules can be listed successfully from lifecycle environment interface :BZ: 1408264 :CaseLevel: Integration """ cv_name = gen_string('alpha') env_name = gen_string('alpha') puppet_module = 'httpd' product = entities.Product(organization=self.organization).create() repo_id = entities.Repository( product=product, content_type=REPO_TYPE['puppet'], url=FAKE_0_PUPPET_REPO ).create().id entities.Repository(id=repo_id).sync() with Session(self) as session: make_lifecycle_environment( session, org=self.organization.name, name=env_name) # Create content-view make_contentview(session, org=self.organization.name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_puppet_module( cv_name, puppet_module, filter_term='Latest', ) self.content_views.publish(cv_name) self.content_views.promote(cv_name, 'Version 1', env_name) self.assertIsNotNone(self.lifecycleenvironment.fetch_puppet_module( env_name, puppet_module, cv_name=cv_name))
def test_positive_delete(self): """Create Content Environment and delete it :id: fe2d9b10-fc46-47e3-827c-6f87d725ed8f :expectedresults: Environment is deleted :CaseImportance: Critical """ name = gen_string('alpha') with Session(self) as session: make_lifecycle_environment( session, org=self.organization.name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.delete(name) self.assertIsNone(self.lifecycleenvironment.search(name))
def test_positive_create(self): """Create content environment with minimal input parameters :id: 2c3a9c4c-3508-4d75-8f60-8bc6f7c0717f :expectedresults: Environment is created :CaseImportance: Critical """ with Session(self.browser) as session: for name in generate_strings_list(): with self.subTest(name): make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone( self.lifecycleenvironment.search(name))
def test_positive_env_list_fits_browser_screen(self): """Check if long list of lifecycle environments fits into screen @id: 63b985b0-c847-11e6-92ad-68f72889dc7f @Setup: save 8+ chained lifecycles environments @BZ: 1295922 @Assert: lifecycle environments table fits screen """ with Session(self.browser) as session: env_names = [gen_string("alpha") for _ in range(11)] for name, prior in zip(env_names, chain([None], env_names)): make_lifecycle_environment(session, org=self.org_name, name=name, prior=prior) envs_table = session.nav.wait_until_element(locator=locators["content_env.table"]) table_width = envs_table.size["width"] body = session.nav.find_element(common_locators["body"]) body_width = body.size["width"] self.assertGreaterEqual(body_width - table_width, 0)
def test_positive_delete(self): """Create Content Environment and delete it :id: fe2d9b10-fc46-47e3-827c-6f87d725ed8f :expectedresults: Environment is deleted :CaseImportance: Critical """ name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name, description=gen_string('alpha'), ) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.delete(name) self.assertIsNone(self.lifecycleenvironment.search(name))
def test_positive_delete_content_environment_1(self): """@Test: Create Content Environment and delete it @Feature: Content Environment - Positive Delete @Assert: Environment is deleted """ name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % name))) self.contentenv.delete(name) session.nav.go_to_life_cycle_environments() self.assertIsNone(self.contentenv.wait_until_element ((strategy, value % name), 3))
def test_positive_update_content_environment(self): """@Test: Create Content Environment and update it @Feature: Content Environment - Positive Update @Assert: Environment is updated """ name = gen_string('alpha') new_name = gen_string('alpha') strategy, value = locators['content_env.select_name'] with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name) self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % name))) self.contentenv.update(name, new_name, gen_string('alpha')) session.nav.go_to_life_cycle_environments() self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % new_name)))
def test_positive_update_content_environment_1(self): """@Test: Create Content Environment and update it @Feature: Content Environment - Positive Update @Assert: Environment is updated """ name = gen_string("alpha", 6) new_name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=name) self.assertIsNotNone( self.contentenv.wait_until_element((strategy, value % name))) self.contentenv.update(name, new_name, description) session.nav.go_to_life_cycle_environments() self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % new_name)))
def test_positive_create_content_environment_2(self): """@Test: Create Content Environment in a chain @Feature: Content Environment - Positive Create @Assert: Environment is created """ env_1_name = generate_string("alpha", 6) env_2_name = generate_string("alpha", 6) description = generate_string("alpha", 6) with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env_1_name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"])) self.contentenv.create(env_2_name, description, prior=env_1_name) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"]))
def test_positive_update(self): """Create Content Environment and update it :id: 5cf64c5b-2105-4384-8630-965d9b8e3024 :expectedresults: Environment is updated :CaseImportance: Critical """ name = gen_string('alpha') new_name = gen_string('alpha') with Session(self.browser) as session: make_lifecycle_environment( session, org=self.org_name, name=name) self.assertIsNotNone(self.lifecycleenvironment.search(name)) self.lifecycleenvironment.update( name, new_name, gen_string('alpha') ) self.assertIsNotNone(self.lifecycleenvironment.search(new_name))
def test_positive_create_content_environment_2(self): """@Test: Create Content Environment in a chain @Feature: Content Environment - Positive Create @Assert: Environment is created """ env1_name = gen_string("alpha", 6) env2_name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env1_name, description=description) self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % env1_name))) self.contentenv.create(env2_name, description, prior=env1_name) self.assertIsNotNone(self.contentenv.wait_until_element ((strategy, value % env2_name)))
def test_cv_promote_rh(self): """@test: attempt to promote a content view containing RH content @feature: Content Views @setup: Multiple environments for an org; RH content synced @assert: Content view can be promoted """ cv_name = gen_string('alpha') rh_repo = { 'name': REPOS['rhst7']['name'], 'product': PRDS['rhel'], 'reposet': REPOSET['rhst7'], 'basearch': 'x86_64', 'releasever': None, } env_name = gen_string('alpha') strategy, value = locators['content_env.select_name'] # Create new org to import manifest org = entities.Organization().create() with Session(self.browser) as session: make_lifecycle_environment( session, org=org.name, name=env_name) self.assertIsNotNone(session.nav.wait_until_element( (strategy, value % env_name))) self.setup_to_create_cv(rh_repo=rh_repo, org_id=org.id) # Create content-view make_contentview(session, org=org.name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [rh_repo['name']]) self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'])) self.content_views.publish(cv_name) self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'])) self.content_views.promote(cv_name, 'Version 1', env_name) self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success']))
def test_cv_promote_rh_1(self): """@test: attempt to promote a content view containing RH content @feature: Content Views @setup: Multiple environments for an org; RH content synced @assert: Content view can be promoted """ cv_name = gen_string("alpha", 8) rh_repo = { 'name': ("Red Hat Enterprise Linux 6 Server " "- RH Common RPMs x86_64 6.5"), 'product': "Red Hat Enterprise Linux Server", 'reposet': ("Red Hat Enterprise Linux 6 Server " "- RH Common (RPMs)"), 'basearch': "x86_64", 'releasever': "6.5" } env_name = gen_string("alpha", 8) publish_version = "Version 1" with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env_name) self.assertIsNotNone(self.contentenv.wait_until_element (common_locators["alert.success"])) self.setup_to_create_cv(session, cv_name, rh_repo=rh_repo) self.content_views.add_remove_repos(cv_name, [rh_repo['name']]) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.publish(cv_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"])) self.content_views.promote(cv_name, publish_version, env_name) self.assertIsNotNone(self.content_views.wait_until_element (common_locators["alert.success"]))
def test_positive_create_content_environment_2(self): """@Test: Create Content Environment in a chain @Feature: Content Environment - Positive Create @Assert: Environment is created """ env1_name = gen_string("alpha", 6) env2_name = gen_string("alpha", 6) description = gen_string("alpha", 6) strategy, value = locators["content_env.select_name"] with Session(self.browser) as session: make_lifecycle_environment(session, org=self.org_name, name=env1_name, description=description) self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % env1_name))) self.contentenv.create(env2_name, description, prior=env1_name) self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % env2_name)))
def test_positive_end_to_end(self): """Perform end to end smoke tests using RH repos. @Feature: Smoke test @Assert: All tests should succeed and Content should be successfully fetched by client """ org_name = gen_string('alpha', 6) cv_name = gen_string('alpha', 6) activation_key_name = gen_string('alpha', 6) env_name = gen_string('alpha', 6) repos = self.sync.create_repos_tree(RHVA_REPO_TREE) with Session(self.browser) as session: # Create New organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # Create New Lifecycle environment make_lifecycle_environment(session, org=org_name, name=env_name) self.assertIsNotNone(self.lifecycleenvironment.search(env_name)) # Navigate UI to select org and redhat subscription page session.nav.go_to_select_org(org_name) session.nav.go_to_red_hat_subscriptions() # Upload manifest from webui with manifests.clone() as manifest: self.subscriptions.upload(manifest) self.assertTrue(session.nav.wait_until_element( common_locators['alert.success'] )) session.nav.go_to_red_hat_repositories() # List of dictionary passed to enable the redhat repos # It selects Product->Reposet-> Repo self.sync.enable_rh_repos(repos) session.nav.go_to_sync_status() # Sync the repos # syn.sync_rh_repos returns boolean values and not objects self.assertTrue(self.sync.sync_rh_repos(repos)) # Create new content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add YUM repository to content-view self.content_views.add_remove_repos( cv_name, [REPOS['rhva65']['name'], REPOS['rhva6']['name']] ) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Publish content-view self.content_views.publish(cv_name) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Promote content-view to life-cycle environment 1 self.content_views.promote( cv_name, version='Version 1', env=env_name) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Create Activation-Key make_activationkey( session, org=org_name, name=activation_key_name, env=env_name, content_view=cv_name ) self.activationkey.associate_product( activation_key_name, [DEFAULT_SUBSCRIPTION_NAME]) self.activationkey.enable_repos( activation_key_name, [REPOSET['rhva6']]) if not bz_bug_is_open(1191541): self.assertIsNotNone(self.activationkey.wait_until_element( common_locators['alert.success'] )) # Create VM with VirtualMachine(distro='rhel66') as vm: vm.install_katello_ca() result = vm.register_contenthost(activation_key_name, org_name) self.assertEqual(result.return_code, 0) # Install contents from sat6 server package_name = 'python-kitchen' result = vm.run(u'yum install -y {0}'.format(package_name)) self.assertEqual(result.return_code, 0) # Verify if package is installed by query it result = vm.run(u'rpm -q {0}'.format(package_name)) self.assertEqual(result.return_code, 0)
def test_positive_puppet_install(self): """Perform puppet end to end smoke tests using RH repos. @id: 30b0f872-d035-431a-988f-2b3fde620c78 @Assert: Client should get configured by puppet-module. """ activation_key_name = gen_string('alpha') cv_name = gen_string('alpha') env_name = gen_string('alpha') org_name = gen_string('alpha') product_name = gen_string('alpha') puppet_module = 'motd' puppet_repository_name = gen_string('alpha') repos = self.sync.create_repos_tree(SAT6_TOOLS_TREE) rhel_prd = DEFAULT_SUBSCRIPTION_NAME rhel6_repo = settings.rhel6_repo with Session(self.browser) as session: # Create New organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # Create New Lifecycle environment make_lifecycle_environment(session, org=org_name, name=env_name) self.assertIsNotNone(self.lifecycleenvironment.search(env_name)) session.nav.go_to_red_hat_subscriptions() # Upload manifest from webui with manifests.clone() as manifest: self.subscriptions.upload(manifest) self.assertTrue( session.nav.wait_until_element( common_locators['alert.success'])) session.nav.go_to_red_hat_repositories() # List of dictionary passed to enable the redhat repos # It selects Product->Reposet-> Repo self.sync.enable_rh_repos(repos, REPO_TAB['rpms']) session.nav.go_to_sync_status() # Sync the repos # syn.sync_rh_repos returns boolean values and not objects self.assertTrue( self.sync.sync_noversion_rh_repos(PRDS['rhel'], [REPOS['rhst6']['name']])) # Create custom product make_product(session, org=org_name, name=product_name) product = self.products.search(product_name) self.assertIsNotNone(product) # Create a puppet Repository product.click() make_repository(session, name=puppet_repository_name, url=FAKE_6_PUPPET_REPO, repo_type=REPO_TYPE['puppet']) self.assertIsNotNone( self.repository.search(puppet_repository_name)) # Sync the repos # syn.sync_rh_repos returns boolean values and not objects session.nav.go_to_sync_status() self.assertIsNotNone( self.sync.sync_custom_repos(product_name, [puppet_repository_name])) # Create new content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add YUM repository to content-view self.content_views.add_remove_repos( cv_name, [REPOS['rhst6']['name']], ) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success'])) # Add puppet-module to content-view self.content_views.add_puppet_module(cv_name, puppet_module, filter_term='Latest') # Publish content-view self.content_views.publish(cv_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success_sub_form'])) # Promote content-view to life-cycle environment. self.content_views.promote(cv_name, version='Version 1', env=env_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success_sub_form'])) # Create Activation-Key make_activationkey(session, org=org_name, name=activation_key_name, env=env_name, content_view=cv_name) self.activationkey.associate_product(activation_key_name, [product_name, rhel_prd]) self.activationkey.enable_repos(activation_key_name, [REPOSET['rhst6']]) if not bz_bug_is_open(1191541): self.assertIsNotNone( self.activationkey.wait_until_element( common_locators['alert.success'])) # Create VM with VirtualMachine(distro=DISTRO_RHEL6) as vm: vm.install_katello_ca() vm.register_contenthost(org_name, activation_key_name) vm.configure_puppet(rhel6_repo) host = vm.hostname set_context(session, org=ANY_CONTEXT['org']) session.nav.go_to_hosts() self.hosts.update_host_bulkactions( [host], action='Assign Organization', parameters_list=[{ 'organization': org_name }], ) self.hosts.update( name=host, parameters_list=[ ['Host', 'Lifecycle Environment', env_name], ['Host', 'Content View', cv_name], ['Host', 'Reset Puppet Environment', True], ], puppet_classes=[puppet_module]) vm.run(u'puppet agent -t') result = vm.run(u'cat /etc/motd | grep FQDN') self.assertEqual(result.return_code, 0)
def test_positive_smoke(self): """Check that basic content can be created * Create a new user with admin permissions * Using the new user from above: * Create a new organization * Create two new lifecycle environments * Create a custom product * Create a custom YUM repository * Create a custom PUPPET repository * Synchronize both custom repositories * Create a new content view * Associate both repositories to new content view * Publish content view * Promote content view to both lifecycles * Create a new libvirt compute resource * Create a new subnet * Create a new domain * Create a new hostgroup and associate previous entities to it @Feature: Smoke Test @Assert: All entities are created and associated. """ user_name = gen_string('alpha') password = gen_string('alpha') org_name = gen_string('alpha') env_1_name = gen_string('alpha') env_2_name = gen_string('alpha') product_name = gen_string('alpha') yum_repository_name = gen_string('alpha') puppet_repository_name = gen_string('alpha') cv_name = gen_string('alpha') compute_resource_name = gen_string('alpha') subnet_name = gen_string('alpha') domain_name = gen_string('alpha') domain = DOMAIN % domain_name hostgroup_name = gen_string('alpha') # Create new user with admin permissions with Session(self.browser) as session: make_user( session, username=user_name, password1=password, password2=password ) self.assertIsNotNone(self.user.search(user_name)) self.assertTrue(self.user.user_admin_role_toggle(user_name)) # FIX ME: UI doesn't authenticate user created via UI auto: Issue #1152 # Once #1152 is fixed; need to pass user_name and password to Session with Session(self.browser) as session: # Create New organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # Create New Lifecycle environment1 make_lifecycle_environment(session, org=org_name, name=env_1_name) self.assertIsNotNone(self.lifecycleenvironment.search(env_1_name)) # Create New Lifecycle environment2 make_lifecycle_environment( session, org=org_name, name=env_2_name, prior=env_1_name ) self.assertIsNotNone(self.lifecycleenvironment.search(env_2_name)) # Create custom product make_product(session, org=org_name, name=product_name) product = self.products.search(product_name) self.assertIsNotNone(product) # Create a YUM repository product.click() make_repository( session, name=yum_repository_name, url=GOOGLE_CHROME_REPO ) self.assertIsNotNone(self.repository.search(yum_repository_name)) # Create a puppet Repository self.products.search(product_name).click() make_repository( session, name=puppet_repository_name, url=FAKE_0_PUPPET_REPO, repo_type=REPO_TYPE['puppet'] ) self.assertIsNotNone(self.repository.search( puppet_repository_name )) # Sync YUM and puppet repository self.navigator.go_to_sync_status() self.assertIsNotNone(self.sync.sync_custom_repos( product_name, [yum_repository_name, puppet_repository_name] )) # Create new content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add YUM repository to content-view self.content_views.add_remove_repos(cv_name, [yum_repository_name]) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Add puppet-module to content-view if not bz_bug_is_open(1297308): self.content_views.add_puppet_module( cv_name, 'httpd', filter_term='Latest' ) # Publish content-view self.content_views.publish(cv_name) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Promote content-view to life-cycle environment 1 self.content_views.promote( cv_name, version='Version 1', env=env_1_name) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Promote content-view to life-cycle environment 2 self.content_views.promote( cv_name, version='Version 1', env=env_2_name) if not bz_bug_is_open(1191422): self.assertIsNotNone(self.content_views.wait_until_element( common_locators['alert.success'] )) # Create a new libvirt compute resource url = ( LIBVIRT_RESOURCE_URL % settings.server.hostname ) make_resource( session, org=org_name, name=compute_resource_name, provider_type=FOREMAN_PROVIDERS['libvirt'], parameter_list=[['URL', url, 'field']], ) self.assertIsNotNone( self.compute_resource.search(compute_resource_name)) # Create a subnet make_subnet( session, org=org_name, subnet_name=subnet_name, subnet_network=gen_ipaddr(ip3=True), subnet_mask='255.255.255.0' ) self.assertIsNotNone(self.subnet.search(subnet_name)) # Create a Domain make_domain( session, org=org_name, name=domain, description=domain ) self.assertIsNotNone(self.domain.search(domain)) # Create a HostGroup make_hostgroup(session, name=hostgroup_name) self.assertIsNotNone(self.hostgroup.search(hostgroup_name))
def test_end_to_end(self): """@Test: Perform end to end smoke tests using RH repos. @Feature: Smoke test @Assert: All tests should succeed and Content should be successfully fetched by client """ org_name = gen_string("alpha", 6) cv_name = gen_string("alpha", 6) activation_key_name = gen_string("alpha", 6) env_name = gen_string("alpha", 6) product_name = "Red Hat Employee Subscription" repo_names = [ "Red Hat Enterprise Virtualization Agents for RHEL 6 Server " "RPMs x86_64 6.5", "Red Hat Enterprise Virtualization Agents for RHEL 6 Server " "RPMs x86_64 6Server", ] repos = self.sync.create_repos_tree(RHVA_REPO_TREE) package_name = "python-kitchen" cloned_manifest_path = manifests.clone() # upload_file function should take care of uploading to sauce labs. upload_file(cloned_manifest_path, remote_file=cloned_manifest_path) with Session(self.browser) as session: # Create New organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # Create New Lifecycle environment make_lifecycle_environment(session, org=org_name, name=env_name) strategy, value = locators["content_env.select_name"] self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % env_name))) # Navigate UI to select org and redhat subscription page session.nav.go_to_select_org(org_name) session.nav.go_to_red_hat_subscriptions() # Upload manifest from webui self.subscriptions.upload(cloned_manifest_path) self.assertTrue( session.nav.wait_until_element( common_locators['alert.success'])) session.nav.go_to_red_hat_repositories() # List of dictionary passed to enable the redhat repos # It selects Product->Reposet-> Repo self.sync.enable_rh_repos(repos) session.nav.go_to_sync_status() # Sync the repos sync = self.sync.sync_rh_repos(repos) # syn.sync_rh_repos returns boolean values and not objects self.assertTrue(sync) # Create new content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add YUM repository to content-view self.content_views.add_remove_repos(cv_name, repo_names) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Publish content-view self.content_views.publish(cv_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Promote content-view to life-cycle environment 1 self.content_views.promote(cv_name, version="Version 1", env=env_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Create Activation-Key make_activationkey(session, org=org_name, name=activation_key_name, env=env_name, content_view=cv_name) self.activationkey.associate_product(activation_key_name, [product_name]) self.activationkey.enable_repos(activation_key_name, [REPOSET['rhva6']]) if not bz_bug_is_open(1191541): self.assertIsNotNone( self.activationkey.wait_until_element( common_locators["alert.success"])) # Create VM with VirtualMachine(distro='rhel66') as vm: # Download and Install rpm result = vm.run( "wget -nd -r -l1 --no-parent -A '*.noarch.rpm' " "http://{0}/pub/".format(self.server_name)) self.assertEqual( result.return_code, 0, "failed to fetch katello-ca rpm: {0}, return code: {1}". format(result.stderr, result.return_code)) result = vm.run('rpm -i katello-ca-consumer*.noarch.rpm') self.assertEqual( result.return_code, 0, "failed to install katello-ca rpm: {0}, return code: {1}". format(result.stderr, result.return_code)) # Register client with foreman server using activation-key result = vm.run( 'subscription-manager register --activationkey {0} ' '--org {1} --force'.format(activation_key_name, org_name)) self.assertEqual( result.return_code, 0, "failed to register client:: {0} and return code: {1}". format(result.stderr, result.return_code)) # Install contents from sat6 server result = vm.run('yum install -y {0}'.format(package_name)) self.assertEqual( result.return_code, 0, "Package install failed: {0} and return code: {1}".format( result.stderr, result.return_code)) # Verify if package is installed by query it result = vm.run('rpm -q {0}'.format(package_name)) self.assertIn(package_name, result.stdout[0])
def test_positive_end_to_end(self): """Perform end to end smoke tests using RH and custom repos. 1. Create a new user with admin permissions 2. Using the new user from above 1. Create a new organization 2. Clone and upload manifest 3. Create a new lifecycle environment 4. Create a custom product 5. Create a custom YUM repository 6. Create a custom PUPPET repository 7. Enable a Red Hat repository 8. Synchronize the three repositories 9. Create a new content view 10. Associate the YUM and Red Hat repositories to new content view 11. Add a PUPPET module to new content view 12. Publish content view 13. Promote content view to the lifecycle environment 14. Create a new activation key 15. Add the products to the activation key 16. Create a new libvirt compute resource 17. Create a new subnet 18. Create a new domain 19. Create a new hostgroup and associate previous entities to it 20. Provision a client @id: 6b7c6187-3cc2-4bd3-89f2-fa7a5f570986 @Assert: All tests should succeed and Content should be successfully fetched by client. """ activation_key_name = gen_string('alpha') compute_resource_name = gen_string('alpha') cv_name = gen_string('alpha') domain_name = DOMAIN % gen_string('alpha') hostgroup_name = gen_string('alpha') lce_name = gen_string('alpha') org_name = gen_string('alpha') password = gen_string('alpha') product_name = gen_string('alpha') puppet_repository_name = gen_string('alpha') if self.fake_manifest_is_set: repos = self.sync.create_repos_tree(RHVA_REPO_TREE) subnet_name = gen_string('alpha') username = gen_string('alpha') yum_repository_name = gen_string('alpha') # step 1: Create a new user with admin permissions with Session(self.browser) as session: make_user( session, admin=True, password1=password, password2=password, username=username, ) self.assertIsNotNone(self.user.search(username)) self.assertTrue(self.user.user_admin_role_toggle(username)) with Session(self.browser, username, password) as session: # step 2.1: Create a new organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # step 2.2: Clone and upload manifest if self.fake_manifest_is_set: session.nav.go_to_select_org(org_name) session.nav.go_to_red_hat_subscriptions() with manifests.clone() as manifest: self.subscriptions.upload(manifest) self.assertTrue( session.nav.wait_until_element( common_locators['alert.success'])) # step 2.3: Create a new lifecycle environment make_lifecycle_environment(session, org=org_name, name=lce_name) self.assertIsNotNone(self.lifecycleenvironment.search(lce_name)) # step 2.4: Create a custom product make_product(session, org=org_name, name=product_name) self.assertIsNotNone(self.products.search(product_name)) # step 2.5: Create custom YUM repository self.products.search(product_name).click() make_repository(session, name=yum_repository_name, url=CUSTOM_RPM_REPO) self.assertIsNotNone(self.repository.search(yum_repository_name)) # step 2.6: Create custom PUPPET repository self.products.search(product_name).click() make_repository(session, name=puppet_repository_name, url=FAKE_0_PUPPET_REPO, repo_type=REPO_TYPE['puppet']) self.assertIsNotNone( self.repository.search(puppet_repository_name)) # step 2.7: Enable a Red Hat repository if self.fake_manifest_is_set: session.nav.go_to_red_hat_repositories() self.sync.enable_rh_repos(repos, REPO_TAB['rpms']) # step 2.8: Synchronize the three repositories self.navigator.go_to_sync_status() self.assertIsNotNone( self.sync.sync_custom_repos( product_name, [yum_repository_name, puppet_repository_name])) if self.fake_manifest_is_set: self.assertTrue(self.sync.sync_rh_repos(repos)) # step 2.9: Create content view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) self.content_views.add_remove_repos(cv_name, [yum_repository_name]) self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success'])) # step 2.10: Associate the YUM and Red Hat repositories to new # content view repositories = [yum_repository_name] if self.fake_manifest_is_set: repositories.append(REPOS['rhva65']['name']) repositories.append(REPOS['rhva6']['name']) self.content_views.add_remove_repos(cv_name, repositories) self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success'])) # step 2.11: Add a PUPPET module to new content view self.content_views.add_puppet_module(cv_name, 'httpd', filter_term='Latest') # step 2.12: Publish content view self.content_views.publish(cv_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success_sub_form'])) # step 2.13: Promote content view to the lifecycle environment self.content_views.promote(cv_name, version='Version 1', env=lce_name) self.assertIsNotNone( self.content_views.wait_until_element( common_locators['alert.success_sub_form'])) # step 2.14: Create a new activation key make_activationkey(session, org=org_name, name=activation_key_name, env=lce_name, content_view=cv_name) self.assertIsNotNone( self.activationkey.wait_until_element( common_locators['alert.success'])) # step 2.15: Add the products to the activation key self.activationkey.associate_product(activation_key_name, [DEFAULT_SUBSCRIPTION_NAME]) # step 2.15.1: Enable product content if self.fake_manifest_is_set: self.activationkey.enable_repos(activation_key_name, [REPOSET['rhva6']]) # step 2.16: Create a new libvirt compute resource make_resource( session, org=org_name, name=compute_resource_name, provider_type=FOREMAN_PROVIDERS['libvirt'], parameter_list=[[ 'URL', (LIBVIRT_RESOURCE_URL % settings.compute_resources.libvirt_hostname), 'field' ]], ) self.assertIsNotNone( self.compute_resource.search(compute_resource_name)) # step 2.17: Create a new subnet make_subnet(session, org=org_name, subnet_name=subnet_name, subnet_network=gen_ipaddr(ip3=True), subnet_mask='255.255.255.0') self.assertIsNotNone(self.subnet.search(subnet_name)) # step 2.18: Create a new domain make_domain(session, org=org_name, name=domain_name, description=domain_name) self.assertIsNotNone(self.domain.search(domain_name)) # step 2.19: Create a new hostgroup and associate previous entities # to it make_hostgroup(session, name=hostgroup_name) self.assertIsNotNone(self.hostgroup.search(hostgroup_name)) # step 2.20: Provision a client self.client_provisioning(activation_key_name, org_name)
def test_smoke(self): """@Test: Check that basic content can be created * Create a new user with admin permissions * Using the new user from above: * Create a new organization * Create two new lifecycle environments * Create a custom product * Create a custom YUM repository * Create a custom PUPPET repository * Synchronize both custom repositories * Create a new content view * Associate both repositories to new content view * Publish content view * Promote content view to both lifecycles * Create a new libvirt compute resource * Create a new subnet * Create a new domain * Create a new hostgroup and associate previous entities to it @Feature: Smoke Test @Assert: All entities are created and associated. """ user_name = gen_string("alpha", 6) password = gen_string("alpha", 6) org_name = gen_string("alpha", 6) env_1_name = gen_string("alpha", 6) env_2_name = gen_string("alpha", 6) product_name = gen_string("alpha", 6) yum_repository_name = gen_string("alpha", 6) puppet_repository_name = gen_string("alpha", 6) cv_name = gen_string("alpha", 6) puppet_module = "httpd" module_ver = 'Latest' compute_resource_name = gen_string("alpha", 6) libvirt_url = "qemu+tcp://%s:16509/system" provider_type = FOREMAN_PROVIDERS['libvirt'] url = (libvirt_url % conf.properties['main.server.hostname']) subnet_name = gen_string("alpha", 6) domain_name = gen_string("alpha", 6) domain = description = DOMAIN % domain_name hostgroup_name = gen_string("alpha", 6) # Create new user with admin permissions with Session(self.browser) as session: make_user(session, username=user_name, password1=password, password2=password) self.assertIsNotNone(self.user.search(user_name, "login")) is_admin_role_selected = self.user.admin_role_to_user(user_name) self.assertTrue(is_admin_role_selected) # FIX ME: UI doesn't authenticate user created via UI auto: Issue #1152 # Once #1152 is fixed; need to pass user_name and password to Session with Session(self.browser) as session: # Create New organization make_org(session, org_name=org_name) self.assertIsNotNone(self.org.search(org_name)) # Create New Lifecycle environment1 make_lifecycle_environment(session, org=org_name, name=env_1_name) strategy, value = locators["content_env.select_name"] self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % env_1_name))) # Create New Lifecycle environment2 make_lifecycle_environment(session, org=org_name, name=env_2_name, prior=env_1_name) self.assertIsNotNone( self.contentenv.wait_until_element( (strategy, value % env_2_name))) # Create custom product make_product(session, org=org_name, name=product_name) self.assertIsNotNone(self.products.search(product_name)) # Create a YUM repository make_repository(session, org=org_name, name=yum_repository_name, product=product_name, url=GOOGLE_CHROME_REPO) self.assertIsNotNone(self.repository.search(yum_repository_name)) # Create a puppet Repository make_repository(session, org=org_name, name=puppet_repository_name, product=product_name, url=FAKE_0_PUPPET_REPO, repo_type=REPO_TYPE['puppet']) self.assertIsNotNone( self.repository.search(puppet_repository_name)) # Sync YUM and puppet repository self.navigator.go_to_sync_status() sync = self.sync.sync_custom_repos( product_name, [yum_repository_name, puppet_repository_name]) self.assertIsNotNone(sync) # Create new content-view make_contentview(session, org=org_name, name=cv_name) self.assertIsNotNone(self.content_views.search(cv_name)) # Add YUM repository to content-view self.content_views.add_remove_repos(cv_name, [yum_repository_name]) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Add puppet-module to content-view self.content_views.add_puppet_module(cv_name, puppet_module, filter_term=module_ver) # Publish content-view self.content_views.publish(cv_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Promote content-view to life-cycle environment 1 self.content_views.promote(cv_name, version="Version 1", env=env_1_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Promote content-view to life-cycle environment 2 self.content_views.promote(cv_name, version="Version 1", env=env_2_name) if not bz_bug_is_open(1191422): self.assertIsNotNone( self.content_views.wait_until_element( common_locators["alert.success"])) # Create a new libvirt compute resource make_resource(session, org=org_name, name=compute_resource_name, provider_type=provider_type, url=url) self.assertIsNotNone( self.compute_resource.search(compute_resource_name)) # Create a subnet make_subnet(session, org=org_name, subnet_name=subnet_name, subnet_network=gen_ipaddr(ip3=True), subnet_mask="255.255.255.0") self.assertIsNotNone(self.subnet.search_subnet(subnet_name)) # Create a Domain make_domain(session, org=org_name, name=domain, description=description) self.assertIsNotNone(self.domain.search(description)) # Create a HostGroup make_hostgroup(session, name=hostgroup_name) self.assertIsNotNone(self.hostgroup.search(hostgroup_name))
def test_positive_custom_user_view_lce(self): """As a custom user attempt to view a lifecycle environment created by admin user :id: 768b647b-c530-4eca-9caa-38cf8622f36d :BZ: 1420511 :Steps: As an admin user: 1. Create an additional lifecycle environments other than Library 2. Create a user without administrator privileges 3. Create a role with the the following permissions: * (Miscellaneous): access_dashboard * Lifecycle Environment: * edit_lifecycle_environments * promote_or_remove_content_views_to_environment * view_lifecycle_environments * Location: view_locations * Organization: view_organizations 4. Assign the created role to the custom user As a custom user: 1. Log in 2. Navigate to Content -> Lifecycle Environments :expectedresults: The additional lifecycle environment is viewable and accessible by the custom user. :CaseLevel: Integration """ role_name = gen_string('alpha') env_name = gen_string('alpha') user_login = gen_string('alpha') user_password = gen_string('alpha') org = entities.Organization().create() role = entities.Role(name=role_name).create() permissions_types_names = { None: ['access_dashboard'], 'Organization': ['view_organizations'], 'Location': ['view_locations'], 'Katello::KTEnvironment': [ 'view_lifecycle_environments', 'edit_lifecycle_environments', 'promote_or_remove_content_views_to_environments' ] } create_role_permissions(role, permissions_types_names) entities.User(default_organization=org, organization=[org], role=[role], login=user_login, password=user_password).create() # create a life cycle environment as admin user and ensure it's visible with Session(self.browser) as session: make_lifecycle_environment(session, org=org.name, name=env_name) self.assertIsNotNone(self.lifecycleenvironment.search(env_name)) # ensure the created user also can find the created life cycle # environment link with Session(self.browser, user=user_login, password=user_password): # to ensure that the created user has only the assigned # permissions, check that hosts menu tab does not exist self.assertIsNone( self.content_views.wait_until_element( menu_locators['menu.hosts'], timeout=1)) # assert that the created user is not a global admin user # check administer->users page with self.assertRaises(UINoSuchElementError): session.nav.go_to_users() # assert that the user can view the lvce created by admin user self.assertIsNotNone(self.lifecycleenvironment.search(env_name))