コード例 #1
0
    def test_negative_create_with_name(self):
        """Don't create an Architecture with invalid data.

        @id: cfed972e-9b09-4852-bdd2-b5a8a8aed170

        @Assert: Architecture is not created.
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.create({'name': name})
コード例 #2
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @feature: Architecture

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
コード例 #3
0
    def test_negative_create_with_name(self):
        """Don't create an Architecture with invalid data.

        @Feature: Architecture

        @Assert: Architecture is not created.
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.create({'name': name})
コード例 #4
0
    def test_negative_create_with_name(self):
        """Don't create an Architecture with invalid data.

        @Feature: Architecture

        @Assert: Architecture is not created.
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.create({'name': name})
コード例 #5
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @id: 78bae664-6493-4c74-a587-94170f20746e

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
コード例 #6
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @feature: Architecture

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.delete({'id': entity_id})
コード例 #7
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        @id: 78bae664-6493-4c74-a587-94170f20746e

        @assert: Architecture is not deleted
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.delete({'id': entity_id})
                self.assert_error_msg(raise_ctx,
                                      "Could not delete the architecture")
コード例 #8
0
    def test_negative_create_with_name(self):
        """Don't create an Architecture with invalid data.

        @id: cfed972e-9b09-4852-bdd2-b5a8a8aed170

        @Assert: Architecture is not created.
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.create({'name': name})
                self.assert_error_msg(raise_ctx,
                                      u'Could not create the architecture:')
コード例 #9
0
    def test_positive_delete_by_id(self):
        """Create Architecture with valid values then delete it
        by ID

        @feature: Architecture

        @assert: Architecture is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                architecture = make_architecture({'name': name})
                Architecture.delete({'id': architecture['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.info({'id': architecture['id']})
コード例 #10
0
    def test_positive_delete_by_id(self):
        """Create Architecture with valid values then delete it
        by ID

        @id: df699e29-29a3-417a-a6ee-81e74b7211a4

        @assert: Architecture is deleted
        """
        for name in valid_data_list():
            with self.subTest(name):
                architecture = make_architecture({'name': name})
                Architecture.delete({'id': architecture['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.info({'id': architecture['id']})
コード例 #11
0
    def test_negative_delete_by_id(self, entity_id):
        """Delete architecture by invalid ID

        :id: 78bae664-6493-4c74-a587-94170f20746e

        :parametrized: yes

        :expectedresults: Architecture is not deleted

        :CaseImportance: Medium
        """
        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.delete({'id': entity_id})

        assert 'Could not delete the architecture' in error.value.message
コード例 #12
0
    def test_negative_delete_by_id(self):
        """Create Architecture then delete it by wrong ID

        :id: 78bae664-6493-4c74-a587-94170f20746e

        :expectedresults: Architecture is not deleted

        :CaseImportance: Critical
        """
        for entity_id in invalid_id_list():
            with self.subTest(entity_id):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.delete({'id': entity_id})
                self.assert_error_msg(raise_ctx,
                                      "Could not delete the architecture")
コード例 #13
0
    def test_negative_create_with_name(self):
        """Don't create an Architecture with invalid data.

        :id: cfed972e-9b09-4852-bdd2-b5a8a8aed170

        :expectedresults: Architecture is not created.

        :CaseImportance: Critical
        """
        for name in invalid_values_list():
            with self.subTest(name):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.create({'name': name})
                self.assert_error_msg(raise_ctx,
                                      u'Could not create the architecture:')
コード例 #14
0
    def test_positive_delete_by_id(self):
        """Create Architecture with valid values then delete it
        by ID

        :id: df699e29-29a3-417a-a6ee-81e74b7211a4

        :expectedresults: Architecture is deleted

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                architecture = make_architecture({'name': name})
                Architecture.delete({'id': architecture['id']})
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.info({'id': architecture['id']})
コード例 #15
0
ファイル: test_os.py プロジェクト: connornishijima/robottelo
    def test_add_architecture(self):
        """@test: Add Architecture to os

        @feature: Operating System - Add architecture

        @assert: Operating System is updated with architecture

        """

        a_ob = make_architecture()

        result = Architecture.info({'id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(
            len(result.stderr), 0, "There should not be an exception here")

        new_obj = make_os()
        result = OperatingSys.add_architecture({'id': new_obj['id'],
                                                'architecture-id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to add architecture")
        self.assertEqual(
            len(result.stderr), 0, "Should not have gotten an error")

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to find object")
        self.assertEqual(len(result.stdout['architectures']), 1)
        self.assertEqual(a_ob['name'], result.stdout['architectures'][0])
コード例 #16
0
    def test_positive_update_name(self):
        """Successfully update an Architecture.

        @id: 67f1e60b-29e2-44a4-8019-498e5ad0e201

        @Assert: Architecture is updated.
        """
        architecture = make_architecture()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                Architecture.update({
                    'id': architecture['id'],
                    'new-name': new_name,
                })
                architecture = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], new_name)
コード例 #17
0
    def test_positive_update_name(self):
        """Successfully update an Architecture.

        @id: 67f1e60b-29e2-44a4-8019-498e5ad0e201

        @Assert: Architecture is updated.
        """
        architecture = make_architecture()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                Architecture.update({
                    'id': architecture['id'],
                    'new-name': new_name,
                })
                architecture = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], new_name)
コード例 #18
0
    def test_negative_create_with_name(self, name):
        """Don't create an Architecture with invalid data.

        :id: cfed972e-9b09-4852-bdd2-b5a8a8aed170

        :parametrized: yes

        :expectedresults: Architecture is not created.

        :CaseImportance: Medium
        """

        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.create({'name': name})

        assert 'Could not create the architecture:' in error.value.message
コード例 #19
0
    def test_add_architecture(self):
        """@test: Add Architecture to os

        @feature: Operating System - Add architecture

        @assert: Operating System is updated with architecture

        """

        a_ob = make_architecture()

        result = Architecture.info({'id': a_ob['id']})
        self.assertEqual(result.return_code, 0, "Failed to create object")
        self.assertEqual(len(result.stderr), 0,
                         "There should not be an exception here")

        new_obj = make_os()
        result = OperatingSys.add_architecture({
            'id': new_obj['id'],
            'architecture-id': a_ob['id']
        })
        self.assertEqual(result.return_code, 0, "Failed to add architecture")
        self.assertEqual(len(result.stderr), 0,
                         "Should not have gotten an error")

        result = OperatingSys.info({'id': new_obj['id']})
        self.assertEqual(result.return_code, 0, "Failed to find object")
        self.assertEqual(len(result.stdout['architectures']), 1)
        self.assertEqual(a_ob['name'], result.stdout['architectures'][0])
コード例 #20
0
    def test_positive_update_name(self):
        """Successfully update an Architecture.

        @Feature: Architecture

        @Assert: Architecture is updated.
        """
        architecture = make_architecture()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                Architecture.update({
                    'id': architecture['id'],
                    'new-name': new_name,
                })
                architecture = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], new_name)
コード例 #21
0
    def test_positive_update_name(self):
        """Successfully update an Architecture.

        @Feature: Architecture

        @Assert: Architecture is updated.
        """
        architecture = make_architecture()
        for new_name in valid_data_list():
            with self.subTest(new_name):
                Architecture.update({
                    'id': architecture['id'],
                    'new-name': new_name,
                })
                architecture = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], new_name)
コード例 #22
0
    def test_negative_update_name(self):
        """Create Architecture then fail to update its name

        @feature: Architecture

        @assert: Architecture name is not updated
        """
        architecture = make_architecture()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.update({
                        'id': architecture['id'],
                        'new-name': new_name,
                    })
                result = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], result['name'])
コード例 #23
0
    def test_negative_update_name(self):
        """Create Architecture then fail to update its name

        @feature: Architecture

        @assert: Architecture name is not updated
        """
        architecture = make_architecture()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError):
                    Architecture.update({
                        'id': architecture['id'],
                        'new-name': new_name,
                    })
                result = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], result['name'])
コード例 #24
0
    def test_positive_update_name(self):
        """Successfully update an Architecture.

        :id: 67f1e60b-29e2-44a4-8019-498e5ad0e201

        :expectedresults: Architecture is updated.

        :CaseImportance: Critical
        """
        architecture = make_architecture()
        for new_name in valid_data_list().values():
            with self.subTest(new_name):
                Architecture.update({
                    'id': architecture['id'],
                    'new-name': new_name
                })
                architecture = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], new_name)
コード例 #25
0
    def test_negative_update_name(self):
        """Create Architecture then fail to update its name

        @id: 037c4892-5e62-46dd-a2ed-92243e870e40

        @assert: Architecture name is not updated
        """
        architecture = make_architecture()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.update({
                        'id': architecture['id'],
                        'new-name': new_name,
                    })
                self.assert_error_msg(raise_ctx,
                                      u'Could not update the architecture:')
                result = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], result['name'])
コード例 #26
0
    def test_negative_update_name(self):
        """Create Architecture then fail to update its name

        @id: 037c4892-5e62-46dd-a2ed-92243e870e40

        @assert: Architecture name is not updated
        """
        architecture = make_architecture()
        for new_name in invalid_values_list():
            with self.subTest(new_name):
                with self.assertRaises(CLIReturnCodeError) as raise_ctx:
                    Architecture.update({
                        'id': architecture['id'],
                        'new-name': new_name,
                    })
                self.assert_error_msg(raise_ctx,
                                      u'Could not update the architecture:')
                result = Architecture.info({'id': architecture['id']})
                self.assertEqual(architecture['name'], result['name'])
コード例 #27
0
ファイル: test_architecture.py プロジェクト: synkd/robottelo
    def test_negative_update_name(self, class_architecture, new_name):
        """Create Architecture then fail to update its name

        :id: 037c4892-5e62-46dd-a2ed-92243e870e40

        :parametrized: yes

        :expectedresults: Architecture name is not updated

        :CaseImportance: Medium
        """

        with pytest.raises(CLIReturnCodeError) as error:
            Architecture.update({'id': class_architecture['id'], 'new-name': new_name})

        assert 'Could not update the architecture:' in error.value.message

        result = Architecture.info({'id': class_architecture['id']})
        assert class_architecture['name'] == result['name']
コード例 #28
0
    def test_positive_delete(self, data):
        """@test: Create architecture with valid values then delete it
        by ID

        @feature: Architecture

        @assert: architecture is deleted

        """
        try:
            new_obj = make_architecture({'name': data})
        except CLIFactoryError as err:
            self.fail(err)

        return_value = Architecture.delete({'id': new_obj['id']})
        self.assertEqual(return_value.return_code, 0)
        self.assertEqual(len(return_value.stderr), 0)

        # Can we find the object?
        result = Architecture.info({'id': new_obj['id']})
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
        self.assertEqual(len(result.stdout), 0)
コード例 #29
0
ファイル: test_architecture.py プロジェクト: cswiii/robottelo
    def test_positive_delete(self, data):
        """@test: Create architecture with valid values then delete it
        by ID

        @feature: Architecture

        @assert: architecture is deleted

        """
        try:
            new_obj = make_architecture({'name': data})
        except CLIFactoryError as err:
            self.fail(err)

        return_value = Architecture.delete({'id': new_obj['id']})
        self.assertEqual(return_value.return_code, 0)
        self.assertEqual(len(return_value.stderr), 0)

        # Can we find the object?
        result = Architecture.info({'id': new_obj['id']})
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
        self.assertEqual(len(result.stdout), 0)
コード例 #30
0
ファイル: test_architecture.py プロジェクト: cswiii/robottelo
    def test_negative_update(self, data):
        """@test: Create architecture then fail to update
        its name

        @feature: Architecture

        @assert: architecture name is not updated

        """
        try:
            new_obj = make_architecture()
        except CLIFactoryError as err:
            self.fail(err)

        # Update the architecture name
        result = Architecture.update({
            'id': new_obj['id'],
            'new-name': data,
        })
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
コード例 #31
0
    def test_negative_update(self, data):
        """@test: Create architecture then fail to update
        its name

        @feature: Architecture

        @assert: architecture name is not updated

        """
        try:
            new_obj = make_architecture()
        except CLIFactoryError as err:
            self.fail(err)

        # Update the architecture name
        result = Architecture.update({
            'id': new_obj['id'],
            'new-name': data,
        })
        self.assertNotEqual(result.return_code, 0)
        self.assertGreater(len(result.stderr), 0)
コード例 #32
0
    def test_positive_CRUD(self):
        """Create a new Architecture, update the name and delete the Architecture itself.

        :id: cd8654b8-e603-11ea-adc1-0242ac120002

        :expectedresults: Architecture is created, modified and deleted successfully

        :CaseImportance: Critical
        """

        name = gen_choice(list(valid_data_list().values()))
        new_name = gen_choice(list(valid_data_list().values()))

        architecture = make_architecture({'name': name})
        assert architecture['name'] == name
        Architecture.update({'id': architecture['id'], 'new-name': new_name})
        architecture = Architecture.info({'id': architecture['id']})
        assert architecture['name'] == new_name
        Architecture.delete({'id': architecture['id']})
        with pytest.raises(CLIReturnCodeError):
            Architecture.info({'id': architecture['id']})
コード例 #33
0
    def test_positive_create_with_synced_content(self):
        """Check if hostgroup with synced kickstart repository can be created

        :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a

        :customerscenario: true

        :expectedresults: Hostgroup should be created and has proper
            installation content id present

        :BZ: 1415707

        :CaseLevel: Integration
        """
        # Check whether path to kickstart media is set
        if settings.rhel6_os is None:
            raise ValueError(
                'Installation media path is not set in properties file')
        # Common entities
        org = make_org()
        lce = make_lifecycle_environment({'organization-id': org['id']})
        product = make_product({'organization-id': org['id']})
        repo = make_repository({
            u'url': settings.rhel6_os,
            u'product-id': product['id'],
            u'content-type': u'yum',
        })
        Repository.synchronize({'id': repo['id']})

        cv = make_content_view({
            'organization-id': org['id'],
            'repository-ids': [repo['id']],
        })
        ContentView.publish({'id': cv['id']})
        cv = ContentView.info({'id': cv['id']})
        cvv = cv['versions'][0]
        ContentView.version_promote({
            'id': cvv['id'],
            'to-lifecycle-environment-id': lce['id'],
        })

        # Get the Partition table ID
        ptable = PartitionTable.info({'name': DEFAULT_PTABLE})

        # Get the arch ID
        arch = Architecture.list(
            {'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0]

        # Get the OS ID
        os = OperatingSys.list({
            'search':
            'name="RedHat" AND major="{0}" OR major="{1}"'.format(
                RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION)
        })[0]

        # Update the OS with found arch and ptable
        OperatingSys.update({
            'id': os['id'],
            'architectures': arch['name'],
            'partition-tables': ptable['name'],
        })
        proxy = Proxy.list({
            'search':
            'url = https://{0}:9090'.format(settings.server.hostname)
        })[0]

        # Search for proper installation repository id
        synced_repo = Repository.list({
            'content-view-version-id': cvv['id'],
            'organization-id': org['id'],
            'environment-id': lce['id'],
        })[0]
        hostgroup = make_hostgroup({
            'lifecycle-environment-id':
            lce['id'],
            'puppet-proxy-id':
            proxy['id'],
            'puppet-ca-proxy-id':
            proxy['id'],
            'content-source-id':
            proxy['id'],
            'content-view-id':
            cv['id'],
            'organization-ids':
            org['id'],
            'architecture-id':
            arch['id'],
            'partition-table-id':
            ptable['id'],
            'operatingsystem-id':
            os['id'],
            'kickstart-repository-id':
            synced_repo['id'],
        })
        hg = HostGroup.info({'id': hostgroup['id']}, output_format='json')
        self.assertEqual(hg['kickstart-repository']['id'], synced_repo['id'])
コード例 #34
0
    def test_positive_create_with_synced_content(self):
        """Check if hostgroup with synced kickstart repository can be created

        :id: 7c51ac72-359c-488a-8658-88b5a94d7e7a

        :customerscenario: true

        :expectedresults: Hostgroup should be created and has proper
            installation content id present

        :BZ: 1415707

        :CaseLevel: Integration
        """
        # Check whether path to kickstart media is set
        if settings.rhel6_os is None:
            raise ValueError(
                'Installation media path is not set in properties file')
        # Common entities
        org = make_org()
        lce = make_lifecycle_environment({'organization-id': org['id']})
        product = make_product({'organization-id': org['id']})
        repo = make_repository({
            u'url': settings.rhel6_os,
            u'product-id': product['id'],
            u'content-type': u'yum',
        })
        Repository.synchronize({'id': repo['id']})

        cv = make_content_view({
            'organization-id': org['id'],
            'repository-ids': [repo['id']],
        })
        ContentView.publish({'id': cv['id']})
        cv = ContentView.info({'id': cv['id']})
        cvv = cv['versions'][0]
        ContentView.version_promote({
            'id': cvv['id'],
            'to-lifecycle-environment-id': lce['id'],
        })

        # Get the Partition table ID
        ptable = PartitionTable.info({'name': DEFAULT_PTABLE})

        # Get the arch ID
        arch = Architecture.list({
            'search': 'name={0}'.format(DEFAULT_ARCHITECTURE)})[0]

        # Get the OS ID
        os = OperatingSys.list({
            'search': 'name="RedHat" AND major="{0}" OR major="{1}"'.format(
                RHEL_6_MAJOR_VERSION, RHEL_7_MAJOR_VERSION)
        })[0]

        # Update the OS with found arch and ptable
        OperatingSys.update({
            'id': os['id'],
            'architectures': arch['name'],
            'partition-tables': ptable['name'],
        })
        proxy = Proxy.list({
            'search': 'url = https://{0}:9090'.format(settings.server.hostname)
        })[0]

        # Search for proper installation repository id
        synced_repo = Repository.list({
            'content-view-version-id': cvv['id'],
            'organization-id': org['id'],
            'environment-id': lce['id'],
        })[0]
        hostgroup = make_hostgroup({
            'lifecycle-environment-id': lce['id'],
            'puppet-proxy-id': proxy['id'],
            'puppet-ca-proxy-id': proxy['id'],
            'content-source-id': proxy['id'],
            'content-view-id': cv['id'],
            'organization-ids': org['id'],
            'architecture-id': arch['id'],
            'partition-table-id': ptable['id'],
            'operatingsystem-id': os['id'],
            'kickstart-repository-id': synced_repo['id'],
        })
        hg = HostGroup.info({'id': hostgroup['id']}, output_format='json')
        self.assertEqual(
            hg['operating-system']['kickstart_repository_id'],
            synced_repo['id']
        )