コード例 #1
0
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(subdomain=gen_string('alpha')),
        gen_url(subdomain=gen_string('alphanumeric')),
        gen_url(subdomain=gen_string('numeric')),
    ]
コード例 #2
0
ファイル: test_setting.py プロジェクト: adammhaile/robottelo
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(subdomain=gen_string('alpha')),
        gen_url(subdomain=gen_string('alphanumeric')),
        gen_url(subdomain=gen_string('numeric')),
    ]
コード例 #3
0
ファイル: test_setting.py プロジェクト: anarang/robottelo
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(scheme=choice(("http", "https")), subdomain=gen_string("alpha")),
        gen_url(scheme=choice(("http", "https")), subdomain=gen_string("alphanumeric")),
        gen_url(scheme=choice(("http", "https")), subdomain=gen_string("numeric")),
    ]
コード例 #4
0
ファイル: test_settings.py プロジェクト: cpeters/robottelo
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(subdomain=gen_string("alpha")),
        gen_url(subdomain=gen_string("alphanumeric")),
        gen_url(subdomain=gen_string("numeric")),
    ]
コード例 #5
0
    def test_positive_create_update_delete(self):
        """Create new http-proxy with attributes, update and delete it.

        :id: 6045010f-b43b-46f0-b80f-21505fa021c8

        :BZ: 1774325

        :steps:

            1. Create http-proxy.
            2. Update http-proxy.
            3. delete http-proxy.

        :expectedresults: CRUD operations related to http-proxy hammer command are successful.

        :CaseImportance: Critical
        """
        loc = make_location()
        org = make_org()
        self.addCleanup(location_cleanup, loc['id'])
        self.addCleanup(org_cleanup, org['id'])
        # Create http proxy
        name = gen_string('alpha', 15)
        url = '{}:{}'.format(gen_url(scheme='https'),
                             gen_integer(min_value=10, max_value=9999))
        password = gen_string('alpha', 15)
        username = gen_string('alpha', 15)
        updated_name = gen_string('alpha', 15)
        updated_url = '{}:{}'.format(gen_url(scheme='https'),
                                     gen_integer(min_value=10, max_value=9999))
        updated_password = gen_string('alpha', 15)
        updated_username = gen_string('alpha', 15)
        http_proxy = HttpProxy.create({
            'name': name,
            'url': url,
            'username': username,
            'password': password,
            'organization-id': org['id'],
            'location-id': loc['id'],
        })
        assert http_proxy['name'] == name
        assert http_proxy['url'] == url
        assert http_proxy['username'] == username
        # Update http-proxy
        HttpProxy.update({
            'name': name,
            'new-name': updated_name,
            'url': updated_url,
            'username': updated_username,
            'password': updated_password,
        })
        updated_http_proxy = HttpProxy.info({'id': http_proxy['id']})
        assert updated_http_proxy['name'] == updated_name
        assert updated_http_proxy['url'] == updated_url
        assert updated_http_proxy['username'] == updated_username
        # Delete http-proxy
        HttpProxy.delete({'id': updated_http_proxy['id']})
        with self.assertRaises(CLIReturnCodeError):
            HttpProxy.info({'id': updated_http_proxy['id']})
コード例 #6
0
    def test_positive_assign_http_proxy_to_products(self):
        """Assign http_proxy to Products and check whether http-proxy is
         used during sync.

        :id: c9d23aa1-3325-4abd-a1a6-d5e75c12b08a

        :expectedresults: HTTP Proxy is assigned to all repos present
            in Products and sync operation uses assigned http-proxy.

        :CaseImportance: Critical
        """
        # create HTTP proxies
        http_proxy_url_a = '{}:{}'.format(
            gen_url(scheme='https'), gen_integer(min_value=10, max_value=9999)
        )
        http_proxy_a = entities.HTTPProxy(
            name=gen_string('alpha', 15), url=http_proxy_url_a, organization=[self.org.id]
        ).create()
        http_proxy_url_b = '{}:{}'.format(
            gen_url(scheme='https'), gen_integer(min_value=10, max_value=9999)
        )
        http_proxy_b = entities.HTTPProxy(
            name=gen_string('alpha', 15), url=http_proxy_url_b, organization=[self.org.id]
        ).create()
        proxy_fqdn = re.split(r'[:]', http_proxy_b.url)[1].strip("//")
        # Create products and repositories
        product_a = entities.Product(organization=self.org).create()
        product_b = entities.Product(organization=self.org).create()
        repo_a1 = entities.Repository(product=product_a, http_proxy_policy='none').create()
        repo_a2 = entities.Repository(
            product=product_a,
            http_proxy_policy='use_selected_http_proxy',
            http_proxy_id=http_proxy_a.id,
        ).create()
        repo_b1 = entities.Repository(product=product_b, http_proxy_policy='none').create()
        repo_b2 = entities.Repository(
            product=product_b, http_proxy_policy='global_default_http_proxy'
        ).create()
        # Add http_proxy to products
        entities.ProductBulkAction().http_proxy(
            data={
                "ids": [product_a.id, product_b.id],
                "http_proxy_policy": "use_selected_http_proxy",
                "http_proxy_id": http_proxy_b.id,
            }
        )
        assert repo_a1.read().http_proxy_policy == "use_selected_http_proxy"
        assert repo_a2.read().http_proxy_policy == "use_selected_http_proxy"
        assert repo_b1.read().http_proxy_policy == "use_selected_http_proxy"
        assert repo_b2.read().http_proxy_policy == "use_selected_http_proxy"
        assert repo_a1.read().http_proxy_id == http_proxy_b.id
        assert repo_a2.read().http_proxy_id == http_proxy_b.id
        assert repo_b1.read().http_proxy_id == http_proxy_b.id
        assert repo_b2.read().http_proxy_id == http_proxy_b.id
        # check if proxy fqdn is present in log during sync
        product_a.sync({'async': True})
        result = ssh.command('grep -F {} /var/log/messages'.format(proxy_fqdn))
        assert result.return_code == 0
コード例 #7
0
    def test_gen_url_8(self):
        """
        @Test: Create a random URL with whitespace subdomain
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        with self.assertRaises(ValueError):
            gen_url(subdomain=" ")
コード例 #8
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_8(self):
        """
        @Test: Create a random URL with whitespace subdomain
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        with self.assertRaises(ValueError):
            gen_url(subdomain=" ")
コード例 #9
0
    def test_gen_url_12(self):
        """
        @Test: Create a random URL with whitespace TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                gen_url(tlds=" ")
コード例 #10
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_12(self):
        """
        @Test: Create a random URL with whitespace TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                gen_url(tlds=" ")
コード例 #11
0
    def test_gen_url_5(self):
        """
        @Test: Create a random URL with invalid scheme
        @Feature: URL Generator
        @Assert: URL should be created with a random scheme
        """

        for turn in range(10):
            scheme = gen_alphanumeric()
            with self.assertRaises(ValueError):
                gen_url(scheme=scheme)
コード例 #12
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_9(self):
        """
        @Test: Create a random URL with invalid subdomain
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            subdomain = gen_cjk()
            with self.assertRaises(ValueError):
                gen_url(subdomain=subdomain)
コード例 #13
0
    def test_gen_url_11(self):
        """
        @Test: Create a random URL with numeric TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                tlds = gen_numeric_string(length=3)
                gen_url(tlds=tlds)
コード例 #14
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_5(self):
        """
        @Test: Create a random URL with invalid scheme
        @Feature: URL Generator
        @Assert: URL should be created with a random scheme
        """

        for turn in range(10):
            scheme = gen_alphanumeric()
            with self.assertRaises(ValueError):
                gen_url(scheme=scheme)
コード例 #15
0
    def test_gen_url_9(self):
        """
        @Test: Create a random URL with invalid subdomain
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            subdomain = gen_cjk()
            with self.assertRaises(ValueError):
                gen_url(subdomain=subdomain)
コード例 #16
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_11(self):
        """
        @Test: Create a random URL with numeric TLDS
        @Feature: URL Generator
        @Assert: URL should not be created
        """

        for turn in range(10):
            with self.assertRaises(ValueError):
                tlds = gen_numeric_string(length=3)
                gen_url(tlds=tlds)
コード例 #17
0
ファイル: test_docker.py プロジェクト: adammhaile/robottelo
    def test_positive_update_url(self):
        """Create an external docker registry and update its URL

        @Feature: Docker

        @Assert: the external registry is updated with the new URL
        """
        url = gen_url(subdomain=gen_string('alpha'))
        new_url = gen_url(subdomain=gen_string('alpha'))
        registry = entities.Registry(url=url).create()
        self.assertEqual(registry.url, url)
        registry.url = new_url
        registry = registry.update()
        self.assertEqual(registry.url, new_url)
コード例 #18
0
    def test_positive_update_url(self):
        """Create an external docker registry and update its URL

        @Feature: Docker

        @Assert: the external registry is updated with the new URL
        """
        url = gen_url(subdomain=gen_string('alpha'))
        new_url = gen_url(subdomain=gen_string('alpha'))
        registry = entities.Registry(url=url).create()
        self.assertEqual(registry.url, url)
        registry.url = new_url
        registry = registry.update()
        self.assertEqual(registry.url, new_url)
コード例 #19
0
ファイル: test_docker.py プロジェクト: jhutar/robottelo
    def test_positive_update_url(self):
        """Create a Docker-type repository and update its URL.

        :id: d85892a2-a887-413d-81c6-97a2a518f365

        :expectedresults: A repository is created with a Docker upstream
            repository and that its URL can be updated.

        :CaseImportance: Critical
        """
        with Session(self) as session:
            name = gen_string('alphanumeric')
            new_url = gen_url()
            product = entities.Product(organization=self.organization).create()
            _create_repository(
                session,
                org=self.organization.name,
                name=name,
                product=product.name,
            )
            self.assertIsNotNone(self.repository.search(name))
            self.assertTrue(
                self.repository.validate_field(name, 'url',
                                               DOCKER_REGISTRY_HUB))
            self.products.search_and_click(product.name)
            self.repository.update(name, new_url=new_url)
            self.products.search_and_click(product.name)
            self.assertTrue(
                self.repository.validate_field(name, 'url', new_url))
コード例 #20
0
ファイル: test_docker.py プロジェクト: lpramuk/robottelo
    def test_update_docker_compute_resource(self):
        """@Test: Create a Docker-based Compute Resource in the Satellite 6
        instance then edit its attributes.

        @Assert: Compute Resource can be created, listed and its attributes can
        be updated.

        @Feature: Docker

        """
        for url in (EXTERNAL_DOCKER_URL, INTERNAL_DOCKER_URL):
            with self.subTest(url):
                compute_resource = make_compute_resource({
                    'provider': DOCKER_PROVIDER,
                    'url': url,
                })
                self.assertEqual(compute_resource['url'], url)
                new_url = gen_url(subdomain=gen_alpha())
                ComputeResource.update({
                    'id': compute_resource['id'],
                    'url': new_url,
                })
                compute_resource = ComputeResource.info({
                    'id': compute_resource['id'],
                })
                self.assertEqual(compute_resource['url'], new_url)
コード例 #21
0
    def test_positive_sort_by_url(self):
        """Create some medium entities and sort them by url path

        :id: 6399f4ad-c081-46c4-89f6-70e552fb603a

        :customerscenario: true

        :expectedresults: Medium entities are sorted properly

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        path_list = [
            gen_url(subdomain=gen_string('alpha', 20).lower(), scheme='https')
            for _ in range(5)
        ]
        for url in path_list:
            entities.Media(path_=url, organization=[organization]).create()
        path_list.sort(key=lambda x: x.split('.', 1)[0], reverse=True)
        with Session(self) as session:
            set_context(session, org=organization.name)
            self.medium.navigate_to_entity()
            self.assertEqual(self.medium.sort_table_by_column('Path'),
                             path_list[::-1])
            self.assertEqual(self.medium.sort_table_by_column('Path'),
                             path_list)
コード例 #22
0
def valid_update_data():
    """Random data for valid update"""
    return {
        'utf8_name': {
            'new-name': gen_string('utf8', 255)
        },
        'alpha_name': {
            'new-name': gen_string('alphanumeric')
        },
        'white_space_name': {
            'new-name': f'white spaces {gen_string("alphanumeric")}'
        },
        'utf8_descr': {
            'description': gen_string('utf8', 255)
        },
        'alpha_descr': {
            'description': gen_string('alphanumeric')
        },
        'gen_url': {
            'url': gen_url()
        },
        'local_url': {
            'url': 'qemu+tcp://localhost:16509/system'
        },
    }
コード例 #23
0
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('alpha'),
        ),
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('alphanumeric'),
        ),
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('numeric'),
        ),
    ]
コード例 #24
0
def test_positive_end_to_end_ad(session, ldap_data, ldap_auth_name):
    """Perform end to end testing for LDAP authentication component with AD

    :id: a6528239-e090-4379-a850-3900ee625b24

    :expectedresults: All expected CRUD actions finished successfully

    :CaseLevel: Integration

    :CaseImportance: High
    """
    new_server = gen_url()
    with session:
        session.ldapauthentication.create({
            'ldap_server.name': ldap_auth_name,
            'ldap_server.host': ldap_data['ldap_hostname'],
            'ldap_server.server_type': LDAP_SERVER_TYPE['UI']['ad'],
            'account.account_name': ldap_data['ldap_user_name'],
            'account.password': ldap_data['ldap_user_passwd'],
            'account.base_dn': ldap_data['base_dn'],
            'account.groups_base_dn': ldap_data['group_base_dn'],
            'attribute_mappings.login': LDAP_ATTR['login_ad'],
            'attribute_mappings.first_name': LDAP_ATTR['firstname'],
            'attribute_mappings.last_name': LDAP_ATTR['surname'],
            'attribute_mappings.mail': LDAP_ATTR['mail'],
        })
        assert session.ldapauthentication.read_table_row(ldap_auth_name)['Name'] == ldap_auth_name
        session.ldapauthentication.update(ldap_auth_name, {'ldap_server.host': new_server})
        assert session.ldapauthentication.read_table_row(ldap_auth_name)['Server'] == new_server
        session.ldapauthentication.delete(ldap_auth_name)
        assert not session.ldapauthentication.read_table_row(ldap_auth_name)
コード例 #25
0
def test_positive_update_console_password(libvirt_url, set_console_password):
    """Update a compute resource with ``--set-console-password``.

    :id: ef09351e-dcd3-4b4f-8d3b-995e9e5873b3

    :expectedresults: No error is returned.

    :BZ: 1100344

    :CaseImportance: High

    :CaseLevel: Component

    :parametrized: yes
    """
    cr_name = gen_string('utf8')
    ComputeResource.create({
        'name': cr_name,
        'provider': 'Libvirt',
        'url': gen_url()
    })
    ComputeResource.update({
        'name': cr_name,
        'set-console-password': set_console_password
    })
コード例 #26
0
def test_gen_url_10():
    """Create a random URL with valid TLDS."""
    for _ in range(10):
        tlds = gen_alpha(length=3)
        result = gen_url(tlds=tlds)
        assert result
        assert result.split('.')[-1] == tlds
コード例 #27
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        :id: 4531b3e3-906b-4835-a6ab-3332dc9bd636

        :expectedresults: Compute Resource is created and set-console-password
            parameter is set

        :BZ: 1214312


        :CaseImportance: Critical
        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider': FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password': console_password,
                    u'url': gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
コード例 #28
0
ファイル: test_docker.py プロジェクト: jhutar/robottelo
    def test_positive_update_internal(self):
        """Create a Docker-based Compute Resource in the Satellite 6
        instance then edit its attributes.

        :id: 6a22e770-6a9a-48ab-94b6-e991e484812d

        :expectedresults: Compute Resource can be created, listed and its
            attributes can be updated.

        :CaseImportance: Critical
        """
        comp_name = gen_string('alphanumeric')
        with Session(self) as session:
            make_resource(
                session,
                name=comp_name,
                provider_type=FOREMAN_PROVIDERS['docker'],
                parameter_list=[[
                    'URL',
                    settings.docker.get_unix_socket_url(), 'field'
                ]],
            )
            self.compute_resource.update(
                name=comp_name,
                parameter_list=[['URL', gen_url(), 'field']],
            )
            self.assertIsNotNone(
                self.compute_resource.wait_until_element(
                    common_locators['notif.success']))
コード例 #29
0
def valid_update_data():
    """Random data for valid update"""
    return (
        {
            u'new-name': gen_string('utf8', 255)
        },
        {
            u'new-name': gen_string('alphanumeric')
        },
        {
            u'new-name':
            'white spaces %s' % gen_string(str_type='alphanumeric')
        },
        {
            u'description': gen_string('utf8', 255)
        },
        {
            u'description': gen_string('alphanumeric')
        },
        {
            u'url': gen_url()
        },
        {
            u'url': 'qemu+tcp://localhost:16509/system'
        },
    )
コード例 #30
0
ファイル: test_docker.py プロジェクト: lpramuk/robottelo
    def test_update_docker_repo_url(self):
        """@Test: Create a Docker-type repository and update its URL.

        @Assert: A repository is created with a Docker image and that its URL
        can be updated.

        @Feature: Docker

        """
        with Session(self.browser) as session:
            name = gen_string('alphanumeric')
            new_url = gen_url()
            product = entities.Product(
                organization=self.organization).create()
            _create_repository(
                session,
                org=self.organization.name,
                name=name,
                product=product.name,
            )
            self.assertIsNotNone(self.repository.search(name))
            self.assertTrue(self.repository.validate_field(
                name, 'url', DOCKER_REGISTRY_HUB))
            self.navigator.go_to_products()
            self.products.search(product.name).click()
            self.repository.update(name, new_url=new_url)
            self.navigator.go_to_products()
            self.products.search(product.name).click()
            self.assertTrue(self.repository.validate_field(
                name, 'url', new_url))
コード例 #31
0
ファイル: test_docker.py プロジェクト: pondrejk/robottelo
    def test_positive_update_url(self):
        """Create a Docker-type repository and update its URL.

        :id: d85892a2-a887-413d-81c6-97a2a518f365

        :expectedresults: A repository is created with a Docker upstream
            repository and that its URL can be updated.

        :CaseImportance: Critical
        """
        with Session(self) as session:
            name = gen_string('alphanumeric')
            new_url = gen_url()
            product = entities.Product(
                organization=self.organization).create()
            _create_repository(
                session,
                org=self.organization.name,
                name=name,
                product=product.name,
            )
            self.assertIsNotNone(self.repository.search(name))
            self.assertTrue(self.repository.validate_field(
                name, 'url', DOCKER_REGISTRY_HUB))
            self.products.search_and_click(product.name)
            self.repository.update(name, new_url=new_url)
            self.products.search_and_click(product.name)
            self.assertTrue(self.repository.validate_field(
                name, 'url', new_url))
コード例 #32
0
    def test_create_comp_res_with_console_password(self, console_password):
        """@Test: Create Compute Resource with different values of
        set-console-password parameter

        @Feature: Compute Resource - Set Console Password

        @Assert: Compute Resource is created and set-console-password
        parameter is set

        @BZ: 1214312

        """
        try:
            comp_resource = make_compute_resource({
                u'url': gen_url(),
                u'provider': FOREMAN_PROVIDERS['libvirt'],
                u'set-console-password': console_password,
            })
        except CLIFactoryError as err:
            self.fail(err)
        result = ComputeResource.info({'id': comp_resource['id']})
        if console_password in (u'True', u'Yes', 1):
            self.assertEqual(result.stdout['set-console-password'], u'true')
        else:
            self.assertEqual(result.stdout['set-console-password'], u'false')
コード例 #33
0
ファイル: test_media.py プロジェクト: synkd/robottelo
    def test_positive_create_update_url(self, module_org):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        :id: a183ee1f-1633-42cd-9132-cce451861b2a

        :expectedresults: Media entity is created and updated properly

        :CaseImportance: Medium
        """
        url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(organization=[module_org], path_=url).create()
        assert media.path_ == url
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        assert media.path_ == new_url
コード例 #34
0
ファイル: test_docker.py プロジェクト: pondrejk/robottelo
    def test_positive_update_internal(self):
        """Create a Docker-based Compute Resource in the Satellite 6
        instance then edit its attributes.

        :id: 6a22e770-6a9a-48ab-94b6-e991e484812d

        :expectedresults: Compute Resource can be created, listed and its
            attributes can be updated.

        :CaseImportance: Critical
        """
        comp_name = gen_string('alphanumeric')
        with Session(self) as session:
            make_resource(
                session,
                name=comp_name,
                provider_type=FOREMAN_PROVIDERS['docker'],
                parameter_list=[[
                    'URL',
                    settings.docker.get_unix_socket_url(),
                    'field'
                ]],
            )
            self.compute_resource.update(
                name=comp_name,
                parameter_list=[['URL', gen_url(), 'field']],
            )
            self.assertIsNotNone(self.compute_resource.wait_until_element(
                common_locators['notif.success']))
コード例 #35
0
ファイル: test_setting.py プロジェクト: waffle-iron/robottelo
def valid_urls():
    """Returns a list of valid urls"""
    return [
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('alpha'),
        ),
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('alphanumeric'),
        ),
        gen_url(
            scheme=choice(('http', 'https')),
            subdomain=gen_string('numeric'),
        ),
    ]
コード例 #36
0
ファイル: test_docker.py プロジェクト: cswiii/robottelo
    def test_update_docker_repo_url(self, name):
        """@Test: Create a Docker-type repository and update its URL.

        @Assert: A repository is created with a Docker image and that its
        URL can be updated.

        @Feature: Docker

        """
        new_url = gen_url(scheme='https')
        prod_id = entities.Product(
            organization=self.org_id).create_json()['id']

        repo_id = _create_repository(prod_id, name)['id']
        real_attrs = entities.Repository(id=repo_id).read_json()
        self.assertEqual(real_attrs['url'], DOCKER_REGISTRY_HUB)

        # Update the repository URL
        real_attrs['url'] = new_url
        client.put(
            entities.Repository(id=repo_id).path(),
            real_attrs,
            auth=get_server_credentials(),
            verify=False,
        ).raise_for_status()
        new_attrs = entities.Repository(id=repo_id).read_json()
        self.assertEqual(new_attrs['url'], new_url)
        self.assertNotEqual(new_attrs['url'], DOCKER_REGISTRY_HUB)
コード例 #37
0
ファイル: test_medium.py プロジェクト: jyejare/robottelo
    def test_positive_sort_by_url(self):
        """Create some medium entities and sort them by url path

        :id: 6399f4ad-c081-46c4-89f6-70e552fb603a

        :expectedresults: Medium entities are sorted properly

        :CaseImportance: Medium
        """
        organization = entities.Organization().create()
        path_list = [
            gen_url(subdomain=gen_string('alpha', 20).lower(), scheme='https')
            for _ in range(5)
        ]
        for url in path_list:
            entities.Media(path_=url, organization=[organization]).create()
        path_list.sort(key=lambda x: x.split('.', 1)[0], reverse=True)
        with Session(self) as session:
            set_context(session, org=organization.name)
            self.medium.navigate_to_entity()
            self.assertEqual(
                self.medium.sort_table_by_column('Path'),
                path_list[::-1]
            )
            self.assertEqual(
                self.medium.sort_table_by_column('Path'),
                path_list
            )
コード例 #38
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        @Feature: Compute Resource - Set Console Password

        @Assert: Compute Resource is created and set-console-password
        parameter is set

        @BZ: 1214312

        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider':
                    FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password':
                    console_password,
                    u'url':
                    gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
コード例 #39
0
    def test_positive_create_with_console_password(self):
        """Create Compute Resource with different values of
        set-console-password parameter

        :id: 4531b3e3-906b-4835-a6ab-3332dc9bd636

        :expectedresults: Compute Resource is created and set-console-password
            parameter is set

        :BZ: 1214312


        :CaseImportance: Critical
        """
        for console_password in (u'True', u'Yes', 1, u'False', u'No', 0):
            with self.subTest(console_password):
                comp_resource = make_compute_resource({
                    u'provider':
                    FOREMAN_PROVIDERS['libvirt'],
                    u'set-console-password':
                    console_password,
                    u'url':
                    gen_url(),
                })
                result = ComputeResource.info({'id': comp_resource['id']})
                if console_password in (u'True', u'Yes', 1):
                    self.assertEqual(result['set-console-password'], u'true')
                else:
                    self.assertEqual(result['set-console-password'], u'false')
コード例 #40
0
    def test_positive_update_console_password(self):
        """Update a compute resource with ``--set-console-password``.

        :id: ef09351e-dcd3-4b4f-8d3b-995e9e5873b3

        :expectedresults: No error is returned.

        Targets BZ 1100344.


        :CaseImportance: Critical
        """
        cr_name = gen_string('utf8')
        ComputeResource.create({
            'name': cr_name,
            'provider': 'Libvirt',
            'url': gen_url(),
        })
        for set_console_password in ('true', 'false'):
            with self.subTest(set_console_password):
                ComputeResource.update({
                    'name':
                    cr_name,
                    'set-console-password':
                    set_console_password,
                })
コード例 #41
0
ファイル: test_docker.py プロジェクト: seandst/robottelo
    def test_update_docker_repo_url(self, name):
        """@Test: Create a Docker-type repository and update its URL.

        @Assert: A repository is created with a Docker image and that its
        URL can be updated.

        @Feature: Docker

        """
        new_url = gen_url(scheme='https')
        prod_id = entities.Product(
            organization=self.org_id
        ).create_json()['id']

        repo_id = _create_repository(prod_id, name)['id']
        real_attrs = entities.Repository(id=repo_id).read_json()
        self.assertEqual(real_attrs['url'], DOCKER_REGISTRY_HUB)

        # Update the repository URL
        real_attrs['url'] = new_url
        client.put(
            entities.Repository(id=repo_id).path(),
            real_attrs,
            auth=get_server_credentials(),
            verify=False,
        ).raise_for_status()
        new_attrs = entities.Repository(id=repo_id).read_json()
        self.assertEqual(new_attrs['url'], new_url)
        self.assertNotEqual(new_attrs['url'], DOCKER_REGISTRY_HUB)
コード例 #42
0
    def test_set_console_password_v2(self, set_console_password):
        """@Test: Update a compute resource with ``--set-console-password``.

        @Feature: Compute Resource

        @Assert: No error is returned.

        Targets BZ 1100344.

        """
        name = gen_string('utf8')
        result = ComputeResource.create({
            'name': name,
            'provider': 'Libvirt',
            'url': gen_url(),
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)

        result = ComputeResource.update({
            'name': name,
            'set-console-password': set_console_password,
        })
        self.assertEqual(result.return_code, 0)
        self.assertEqual(len(result.stderr), 0)
コード例 #43
0
    def test_gen_url_7(self):
        """
        @Test: Create a random URL with empty subdomain
        @Feature: URL Generator
        @Assert: URL should be created with a random subdomain
        """

        result = gen_url(subdomain='')
        self.assertTrue(len(result) > 0, "A valid URL was not generated.")
コード例 #44
0
def valid_update_data():
    """Random data for valid update"""
    return(
        {u'new-name': gen_string('utf8', 255)},
        {u'new-name': gen_string('alphanumeric')},
        {u'description': gen_string('utf8', 255)},
        {u'description': gen_string('alphanumeric')},
        {u'url': gen_url()},
        {u'url': 'qemu+tcp://localhost:16509/system'},
    )
コード例 #45
0
def test_gen_url_6():
    """Create a random URL with valid subdomain."""
    for _ in range(10):
        subdomain = gen_alphanumeric()
        result = gen_url(subdomain=subdomain)
        assert result

        # Breakdown the generated URL
        scheme_breakdown = result.split('//')
        domain = scheme_breakdown[1].split('.')
        assert domain[0] == subdomain
コード例 #46
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_7(self):
        """
        @Test: Create a random URL with empty subdomain
        @Feature: URL Generator
        @Assert: URL should be created with a random subdomain
        """

        result = gen_url(subdomain='')
        self.assertTrue(
            len(result) > 0,
            "A valid URL was not generated.")
コード例 #47
0
    def test_negative_create_with_url(self):
        """Proxy creation with random URL

        @id: e48a6260-97e0-4234-a69c-77bbbcde85d6

        @Assert: Proxy is not created
        """
        # Create a random proxy
        with self.assertRaises(HTTPError) as context:
            entities.SmartProxy(url=gen_url(scheme='https')).create()
        self.assertRegexpMatches(
            context.exception.response.text, u'Unable to communicate')
コード例 #48
0
    def test_gen_url_4(self):
        """
        @Test: Create a random URL with ftp scheme
        @Feature: URL Generator
        @Assert: URL should be created with \'ftp\' scheme
        """

        for turn in range(10):
            result = gen_url(scheme='ftp')
            self.assertTrue(len(result) > 0, "A valid URL was not generated.")
            self.assertTrue(
                result.split(":")[0] == 'ftp', "URL does not start with ftp")
コード例 #49
0
ファイル: test_media.py プロジェクト: anarang/robottelo
    def test_positive_update_url(self):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        @Feature: Media

        @Assert: Media entity is created and updated properly
        """
        media = entities.Media(organization=[self.org]).create()
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        self.assertEqual(media.path_, new_url)
コード例 #50
0
    def test_positive_update_url(self):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        @Feature: Media

        @Assert: Media entity is created and updated properly
        """
        media = entities.Media(organization=[self.org]).create()
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        self.assertEqual(media.path_, new_url)
コード例 #51
0
    def test_gen_url_1(self):
        """
        @Test: Create a random URL
        @Feature: URL Generator
        @Assert:  URL should be created with random values
        """

        for turn in range(10):
            result = gen_url()
            self.assertTrue(len(result) > 0, "A valid URL was not generated.")
            self.assertTrue(
                result.split(":")[0] in SCHEMES,
                "URL does not start with a valid scheme")
コード例 #52
0
    def test_negative_create_with_url(self):
        """Proxy creation with random URL

        :id: e48a6260-97e0-4234-a69c-77bbbcde85d6

        :expectedresults: Proxy is not created

        :CaseLevel: Component

        """
        # Create a random proxy
        with self.assertRaises(HTTPError) as context:
            entities.SmartProxy(url=gen_url(scheme='https')).create()
        self.assertRegexpMatches(context.exception.response.text, 'Unable to communicate')
コード例 #53
0
    def test_positive_update_url(self):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        @id: 997fd9f6-4809-4de8-869d-7a4a0bf4c958

        @Assert: Media entity is created and updated properly

        @CaseLevel: Integration
        """
        media = entities.Media(organization=[self.org]).create()
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        self.assertEqual(media.path_, new_url)
コード例 #54
0
ファイル: test_media.py プロジェクト: Ichimonji10/robottelo
    def test_positive_update_url(self):
        """Create media entity providing the initial url path, then
        update that url to another valid one.

        @id: 997fd9f6-4809-4de8-869d-7a4a0bf4c958

        @Assert: Media entity is created and updated properly

        @CaseLevel: Integration
        """
        media = entities.Media(organization=[self.org]).create()
        new_url = gen_url(subdomain=gen_string('alpha'))
        media = entities.Media(id=media.id, path_=new_url).update(['path_'])
        self.assertEqual(media.path_, new_url)
コード例 #55
0
    def test_negative_create_with_same_name(self):
        """Compute Resource negative create with the same name

        @Feature: Compute Resource create

        @Assert: Compute resource not created

        """
        comp_res = make_compute_resource()
        with self.assertRaises(CLIReturnCodeError):
            ComputeResource.create({
                u'name': comp_res['name'],
                u'provider': FOREMAN_PROVIDERS['libvirt'],
                u'url': gen_url(),
            })
コード例 #56
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_1(self):
        """
        @Test: Create a random URL
        @Feature: URL Generator
        @Assert:  URL should be created with random values
        """

        for turn in range(10):
            result = gen_url()
            self.assertTrue(
                len(result) > 0,
                "A valid URL was not generated.")
            self.assertTrue(
                result.split(":")[0] in SCHEMES,
                "URL does not start with a valid scheme"
            )
コード例 #57
0
ファイル: test_urls.py プロジェクト: Ichimonji10/fauxfactory
    def test_gen_url_4(self):
        """
        @Test: Create a random URL with ftp scheme
        @Feature: URL Generator
        @Assert: URL should be created with \'ftp\' scheme
        """

        for turn in range(10):
            result = gen_url(scheme='ftp')
            self.assertTrue(
                len(result) > 0,
                "A valid URL was not generated.")
            self.assertTrue(
                result.split(":")[0] == 'ftp',
                "URL does not start with ftp"
            )
コード例 #58
0
    def test_positive_create_with_libvirt(self):
        """Test Compute Resource create

        @Feature: Compute Resource positive create

        @Assert: Compute Resource created

        """
        for options in valid_name_desc_data():
            with self.subTest(options):
                ComputeResource.create({
                    u'description': options['description'],
                    u'name': options['name'],
                    u'provider': FOREMAN_PROVIDERS['libvirt'],
                    u'url': gen_url(),
                })
コード例 #59
0
    def test_negative_create_with_name_url(self):
        """Compute Resource negative create with invalid values

        @id: cd432ff3-b3b9-49cd-9a16-ed00d81679dd

        @Assert: Compute resource not created
        """
        for options in invalid_create_data():
            with self.subTest(options):
                with self.assertRaises(CLIReturnCodeError):
                    ComputeResource.create({
                        u'name': options.get(
                            'name', gen_string(str_type='alphanumeric')),
                        u'provider': FOREMAN_PROVIDERS['libvirt'],
                        u'url': options.get('url', gen_url()),
                    })
コード例 #60
0
    def test_positive_create_with_libvirt(self):
        """Test Compute Resource create

        @id: adc6f4f8-6420-4044-89d1-c69e0bfeeab9

        @Assert: Compute Resource created

        """
        for options in valid_name_desc_data():
            with self.subTest(options):
                ComputeResource.create({
                    u'description': options['description'],
                    u'name': options['name'],
                    u'provider': FOREMAN_PROVIDERS['libvirt'],
                    u'url': gen_url(),
                })