def test_proxy_update(self, data): """@Test: Proxy name update with the home proxy @Feature: Smart Proxy @Assert: Proxy has the name updated """ try: proxy = make_proxy({u'name': data['name']}) except CLIFactoryError as err: self.fail(err) self.assertEquals(proxy['name'], data['name'], "Input and output name should be consistent") with default_url_on_new_port(9090, random.randint(9091, 49090)) as url: result = Proxy.update({ u'id': proxy['id'], u'name': data['update'], u'url': url }) self.assertEqual(result.return_code, 0, "Proxy should be updated") result = Proxy.info({u'id': proxy['id']}) self.assertEqual(result.return_code, 0, "Proxy should be found") self.assertEqual(result.stdout['name'], data['update'], "Proxy name should be updated")
def test_positive_update_name(request): """Proxy name update with the home proxy :id: 1a02a06b-e9ab-4b9b-bcb0-ac7060188316 :expectedresults: Proxy has the name updated :CaseLevel: Component :BZ: 1398695 """ proxy = _make_proxy(request, {'name': gen_alphanumeric()}) for new_name in valid_data_list().values(): newport = get_available_capsule_port() with default_url_on_new_port(9090, newport) as url: Proxy.update({'id': proxy['id'], 'name': new_name, 'url': url}) proxy = Proxy.info({'id': proxy['id']}) assert proxy['name'] == new_name
def test_positive_update_name(self): """Proxy name update with the home proxy @Feature: Smart Proxy @Assert: Proxy has the name updated """ proxy = make_proxy({u'name': gen_alphanumeric()}) newport = random.randint(9091, 49090) for new_name in valid_data_list(): with self.subTest(new_name): with default_url_on_new_port(9090, newport) as url: Proxy.update({ u'id': proxy['id'], u'name': new_name, u'url': url, }) proxy = Proxy.info({u'id': proxy['id']}) self.assertEqual(proxy['name'], new_name)
def test_positive_update_name(self): """Proxy name update with the home proxy @id: 1a02a06b-e9ab-4b9b-bcb0-ac7060188316 @Assert: Proxy has the name updated """ proxy = make_proxy({u'name': gen_alphanumeric()}) for new_name in valid_data_list(): with self.subTest(new_name): newport = get_available_capsule_port() with default_url_on_new_port(9090, newport) as url: Proxy.update({ u'id': proxy['id'], u'name': new_name, u'url': url, }) proxy = Proxy.info({u'id': proxy['id']}) self.assertEqual(proxy['name'], new_name) # Add capsule id to cleanup list self.addCleanup(capsule_cleanup, proxy['id'])
def test_positive_update_name(self): """Proxy name update with the home proxy :id: 1a02a06b-e9ab-4b9b-bcb0-ac7060188316 :expectedresults: Proxy has the name updated :CaseImportance: Critical """ proxy = self._make_proxy({u'name': gen_alphanumeric()}) for new_name in valid_data_list(): with self.subTest(new_name): newport = get_available_capsule_port() with default_url_on_new_port(9090, newport) as url: Proxy.update({ u'id': proxy['id'], u'name': new_name, u'url': url, }) proxy = Proxy.info({u'id': proxy['id']}) self.assertEqual(proxy['name'], new_name)
def test_proxy_update(self, data): """@Test: Proxy name update with the home proxy @Feature: Smart Proxy @Assert: Proxy has the name updated """ try: proxy = make_proxy({u'name': data['name']}) except CLIFactoryError as err: self.fail(err) self.assertEquals( proxy['name'], data['name'], "Input and output name should be consistent") with default_url_on_new_port(9090, random.randint(9091, 49090)) as url: result = Proxy.update({ u'id': proxy['id'], u'name': data['update'], u'url': url}) self.assertEqual( result.return_code, 0, "Proxy should be updated" ) result = Proxy.info({u'id': proxy['id']}) self.assertEqual( result.return_code, 0, "Proxy should be found" ) self.assertEqual( result.stdout['name'], data['update'], "Proxy name should be updated" )
def configure_puppet_test(cls): """Sets up the whole provisioning environment needed for Puppet based end-to-end tests like OSCAP etc :returns: A dict of entities to help with provisioning """ cls.rhel6_content = OSCAP_DEFAULT_CONTENT['rhel6_content'] cls.rhel7_content = OSCAP_DEFAULT_CONTENT['rhel7_content'] sat6_hostname = settings.server.hostname proxy = Proxy.list({'search': sat6_hostname})[0] p_features = set(proxy.get('features').split(', ')) if {'Puppet', 'Ansible', 'Openscap'}.issubset(p_features): cls.proxy_id = proxy.get('id') else: raise ProxyError( 'Some features like Puppet, DHCP, Openscap, Ansible are not present' ) ak_name_7 = gen_string('alpha') ak_name_6 = gen_string('alpha') repo_values = [ { 'repo': settings.sattools_repo['rhel6'], 'akname': ak_name_6 }, { 'repo': settings.sattools_repo['rhel7'], 'akname': ak_name_7 }, ] # Create new organization and environment. org = entities.Organization(name=gen_string('alpha')).create() loc = entities.Location().search( query={'search': "{0}".format(DEFAULT_LOC)})[0].read() cls.puppet_env = entities.Environment().search( query={u'search': u'name=production'})[0].read() cls.puppet_env.location.append(loc) cls.puppet_env.organization.append(org) cls.puppet_env = cls.puppet_env.update(['location', 'organization']) Proxy.import_classes({ u'environment': cls.puppet_env.name, u'name': sat6_hostname, }) Proxy.update({ 'id': cls.proxy_id, 'organizations': org.name, 'locations': DEFAULT_LOC }) env = entities.LifecycleEnvironment(organization=org, name=gen_string('alpha')).create() # Create content view content_view = entities.ContentView(organization=org, name=gen_string('alpha')).create() # Create two activation keys for rhel7 and rhel6 for repo in repo_values: activation_key = entities.ActivationKey( name=repo.get('akname'), environment=env, organization=org, ).create() # Setup org for a custom repo for RHEL6 and RHEL7 setup_org_for_a_custom_repo({ 'url': repo.get('repo'), 'organization-id': org.id, 'content-view-id': content_view.id, 'lifecycle-environment-id': env.id, 'activationkey-id': activation_key.id }) for content in cls.rhel6_content, cls.rhel7_content: Scapcontent.update({ 'title': content, 'organizations': org.name, 'locations': DEFAULT_LOC }) return { 'org_name': org.name, 'cv_name': content_view.name, 'sat6_hostname': settings.server.hostname, 'ak_name': { 'rhel7': ak_name_7, 'rhel6': ak_name_6 }, 'env_name': env.name, }