コード例 #1
0
ファイル: test_oscap.py プロジェクト: jyejare/robottelo
    def test_negative_create_scap_content_without_dsfile(self):
        """Create scap-content without scap data stream xml file

        :id: ea811994-12cd-4382-9382-37fa806cc26f

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Don't pass the scap-file parameter.

        :expectedresults: The scap-content is not created.

        :caseautomation: automated

        :CaseImportance: Critical
        """
        for title in valid_data_list():
            with self.subTest(title):
                with self.assertRaises(CLIFactoryError):
                    make_scapcontent({'title': title})
コード例 #2
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_negative_create_scap_content_with_invalid_title(self):
        """Create scap-content with invalid title

        :id: 90a2590e-a6ff-41f1-9e0a-67d4b16435c0

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        for title in invalid_names_list():
            with self.subTest(title):
                with self.assertRaises(CLIFactoryError):
                    make_scapcontent({
                        'title': title,
                        'scap-file': '/tmp/{0}'.format(self.file_name)})
コード例 #3
0
    def test_negative_create_scap_content_with_invalid_title(self, title):
        """Create scap-content with invalid title

        :id: 90a2590e-a6ff-41f1-9e0a-67d4b16435c0

        :parametrized: yes

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        with pytest.raises(CLIFactoryError):
            make_scapcontent({
                'title': title,
                'scap-file': settings.oscap.content_path
            })
コード例 #4
0
    def test_negative_create_scap_content_with_invalid_originalfile_name(self):
        """Create scap-content with invalid original file name

        :id: 83feb67a-a6bf-4a99-923d-889e8d1013fa

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        for name in invalid_names_list():
            with self.subTest(name):
                with self.assertRaises(CLIFactoryError):
                    make_scapcontent({
                        'original-filename':
                        name,
                        'scap-file':
                        '/tmp/{0}'.format(self.file_name)
                    })
コード例 #5
0
    def test_negative_create_scap_content_with_invalid_originalfile_name(
            self, name):
        """Create scap-content with invalid original file name

        :id: 83feb67a-a6bf-4a99-923d-889e8d1013fa

        :parametrized: yes

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical

        :BZ: 1482395
        """
        with pytest.raises(CLIFactoryError):
            make_scapcontent({
                'original-filename': name,
                'scap-file': settings.oscap.content_path
            })
コード例 #6
0
    def test_negative_create_scap_content_with_same_title(self):
        """Create scap-content with same title

        :id: a8cbacc9-456a-4f6f-bd0e-4d1167a8b401

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.
            4. Execute "scap-content" command with "create" as sub-command
               with same title

        :expectedresults: The scap-content is not created.

        :BZ: 1474172

        :CaseAutomation: Automated

        :CaseImportance: Medium
        """
        title = gen_string('alpha')
        scap_content = make_scapcontent({'title': title, 'scap-file': settings.oscap.content_path})
        assert scap_content['title'] == title
        with pytest.raises(CLIFactoryError):
            make_scapcontent({'title': title, 'scap-file': settings.oscap.content_path})
コード例 #7
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_negative_info_scap_content_viewer_role(self):
        """View info of scap content with viewer role

        :id: 15eb035b-d301-4dbd-b66a-c4621d2003a3

        :setup:

            1. Oscap should be enabled.
            2. Default content should already be populated.
            3. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell with user with viewer role.
            2. Execute the "scap-content" command with info as sub-command.
            3. Pass valid parameters.

        :expectedresults: The info of the scap-content is not listed.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        make_scapcontent({
            'title': title,
            'scap-file': '/tmp/{0}'.format(self.file_name)})
        login, password = self.create_test_user_viewer_role()
        with self.assertRaises(CLIReturnCodeError):
            Scapcontent.with_user(login, password).info({'title': title})
コード例 #8
0
    def test_negative_create_scap_content_with_invalid_title(self):
        """Create scap-content with invalid title

        :id: 90a2590e-a6ff-41f1-9e0a-67d4b16435c0

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        for title in invalid_names_list():
            with self.subTest(title):
                with self.assertRaises(CLIFactoryError):
                    make_scapcontent({
                        'title':
                        title,
                        'scap-file':
                        '/tmp/{0}'.format(self.file_name)
                    })
コード例 #9
0
    def test_positive_view_scap_content_info_admin(self):
        """View info of scap content with admin account

        :id: 539ea982-0701-43f5-bb91-e566e6687e35

        :setup:

            1. Oscap should be enabled.
            2. Default content should already be populated.
            3. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell as admin.
            2. Execute the "scap-content" command with info as sub-command.
            3. Pass valid "ID" of scap-content as argument.

        :expectedresults: The info of the scap-content is listed.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        make_scapcontent({
            'title': title,
            'scap-file': settings.oscap.content_path
        })
        result = Scapcontent.info({'title': title})
        assert result['title'] == title
コード例 #10
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_view_scap_content_info_admin(self):
        """View info of scap content with admin account

        :id: 539ea982-0701-43f5-bb91-e566e6687e35

        :setup:

            1. Oscap should be enabled.
            2. Default content should already be populated.
            3. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell as admin.
            2. Execute the "scap-content" command with info as sub-command.
            3. Pass valid "ID" of scap-content as argument.

        :expectedresults: The info of the scap-content is listed.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        make_scapcontent({
            'title': title,
            'scap-file': '/tmp/{0}'.format(self.file_name)})
        result = Scapcontent.info({'title': title})
        self.assertEqual(result['title'], title)
コード例 #11
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_negative_create_scap_content_with_invalid_originalfile_name(self):
        """Create scap-content with invalid original file name

        :id: 83feb67a-a6bf-4a99-923d-889e8d1013fa

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters and invalid title.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        for name in invalid_names_list():
            with self.subTest(name):
                with self.assertRaises(CLIFactoryError):
                    make_scapcontent({
                        'original-filename': name,
                        'scap-file': '/tmp/{0}'.format(self.file_name)})
コード例 #12
0
    def test_negative_info_scap_content_viewer_role(self):
        """View info of scap content with viewer role

        :id: 15eb035b-d301-4dbd-b66a-c4621d2003a3

        :setup:

            1. Oscap should be enabled.
            2. Default content should already be populated.
            3. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell with user with viewer role.
            2. Execute the "scap-content" command with info as sub-command.
            3. Pass valid parameters.

        :expectedresults: The info of the scap-content is not listed.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        make_scapcontent({
            'title': title,
            'scap-file': '/tmp/{0}'.format(self.file_name)
        })
        login, password = self.create_test_user_viewer_role()
        with self.assertRaises(CLIReturnCodeError):
            Scapcontent.with_user(login, password).info({'title': title})
コード例 #13
0
 def setUpClass(cls):
     super(OpenScapTestCase, cls).setUpClass()
     cls.title = gen_string('alpha')
     result = [scap['title'] for scap in Scapcontent.list() if scap.get('title') in cls.title]
     if not result:
         make_scapcontent({'title': cls.title, 'scap-file': settings.oscap.content_path})
     cls.scap_id_rhel7, cls.scap_profile_id_rhel7 = cls.fetch_scap_and_profile_id(
         cls.title, OSCAP_PROFILE['security7']
     )
     cls.tailoring_file_path = file_downloader(
         file_url=settings.oscap.tailoring_path, hostname=settings.server.hostname
     )[0]
     Ansible.roles_import({'proxy-id': 1})
     Ansible.variables_import({'proxy-id': 1})
コード例 #14
0
    def test_positive_create_scap_content_with_valid_originalfile_name(
            self, name):
        """Create scap-content with valid original file name

        :id: 25441174-11cb-4d9b-9ec5-b1c69411b5bc

        :parametrized: yes

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created.

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent({
            'original-filename':
            name,
            'scap-file':
            settings.oscap.content_path
        })
        assert scap_content['original-filename'] == name
コード例 #15
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_create_scap_content_with_valid_originalfile_name(self):
        """Create scap-content with valid original file name

        :id: 25441174-11cb-4d9b-9ec5-b1c69411b5bc

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created.

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                scap_content = make_scapcontent({
                    'original-filename': name,
                    'scap-file': '/tmp/{0}'.format(self.file_name)})
                self.assertEqual(scap_content['original-filename'], name)
コード例 #16
0
    def test_positive_delete_scap_content_with_id(self):
        """Delete a scap content with id as parameter

        :id: 11ae7652-65e0-4751-b1e0-246b27919238

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "delete" as sub-command.
            3. Pass ID as parameter.

        :expectedresults: The scap-content is deleted successfully.

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent(
            {'scap-file': settings.oscap.content_path})
        Scapcontent.delete({'id': scap_content['id']})
        with pytest.raises(CLIReturnCodeError):
            Scapcontent.info({'id': scap_content['id']})
コード例 #17
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_update_scap_content_with_newtitle(self):
        """Update scap content title

        :id: 2c32e94a-237d-40b9-8a3b-fca2ef26fe79

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "update" as sub-command.
            3. Pass valid parameters and newtitle parameter.

        :expectedresults: The scap-content is updated successfully.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        new_title = gen_string('alpha')
        scap_content = make_scapcontent({
            'title': title,
            'scap-file': '/tmp/{0}'.format(self.file_name)})
        self.assertEqual(scap_content['title'], title)
        result = Scapcontent.update({
            'title': title,
            'new-title': new_title})
        if bz_bug_is_open(1496810):
            result = Scapcontent.info({'title': new_title})
        self.assertEqual(result['title'], new_title)
コード例 #18
0
    def test_positive_create_scap_content_with_valid_originalfile_name(self):
        """Create scap-content with valid original file name

        :id: 25441174-11cb-4d9b-9ec5-b1c69411b5bc

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created.

        :CaseImportance: Critical
        """
        for name in valid_data_list():
            with self.subTest(name):
                scap_content = make_scapcontent({
                    'original-filename':
                    name,
                    'scap-file':
                    '/tmp/{0}'.format(self.file_name)
                })
                self.assertEqual(scap_content['original-filename'], name)
コード例 #19
0
    def test_positive_create_scap_content_with_valid_title(self):
        """Create scap-content with valid title

        :id: 68e9fbe2-e3c3-48e7-a774-f1260a3b7f4f

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created successfully.

        :BZ: 1471801

        :CaseImportance: Critical
        """
        for title in valid_data_list():
            with self.subTest(title):
                scap_content = make_scapcontent({
                    'title':
                    title,
                    'scap-file':
                    '/tmp/{0}'.format(self.file_name)
                })
                self.assertEqual(scap_content['title'], title)
コード例 #20
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_delete_scap_content_with_title(self):
        """Delete a scap content with title as parameter

        :id: aa4ca830-3250-4517-b40c-0256cdda5e0a

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "delete" as sub-command.
            3. Pass name as parameter.

        :expectedresults: The scap-content is deleted successfully.

        :caseautomation: automated

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent({
            'scap-file': '/tmp/{0}'.format(self.file_name)})
        Scapcontent.delete({'title': scap_content['title']})
        with self.assertRaises(CLIReturnCodeError):
            Scapcontent.info({'title': scap_content['title']})
コード例 #21
0
    def test_positive_update_scap_content_with_newtitle(self):
        """Update scap content title

        :id: 2c32e94a-237d-40b9-8a3b-fca2ef26fe79

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "update" as sub-command.
            3. Pass valid parameters and newtitle parameter.

        :expectedresults: The scap-content is updated successfully.

        :CaseImportance: Critical

        :BZ: 1490302
        """
        title = gen_string('alpha')
        new_title = gen_string('alpha')
        scap_content = make_scapcontent({
            'title':
            title,
            'scap-file':
            settings.oscap.content_path
        })
        assert scap_content['title'] == title
        Scapcontent.update({'title': title, 'new-title': new_title})
        result = Scapcontent.info({'title': new_title}, output_format='json')
        assert result['title'] == new_title
コード例 #22
0
    def test_positive_update_scap_content_with_newtitle(self):
        """Update scap content title

        :id: 2c32e94a-237d-40b9-8a3b-fca2ef26fe79

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "update" as sub-command.
            3. Pass valid parameters and newtitle parameter.

        :expectedresults: The scap-content is updated successfully.

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        new_title = gen_string('alpha')
        scap_content = make_scapcontent({
            'title':
            title,
            'scap-file':
            '/tmp/{0}'.format(self.file_name)
        })
        self.assertEqual(scap_content['title'], title)
        result = Scapcontent.update({'title': title, 'new-title': new_title})
        if bz_bug_is_open(1496810):
            result = Scapcontent.info({'title': new_title},
                                      output_format='json')
        self.assertEqual(result['title'], new_title)
コード例 #23
0
    def test_positive_delete_scap_content_with_title(self):
        """Delete a scap content with title as parameter

        :id: aa4ca830-3250-4517-b40c-0256cdda5e0a

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "delete" as sub-command.
            3. Pass name as parameter.

        :expectedresults: The scap-content is deleted successfully.

        :CaseAutomation: Automated

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent(
            {'scap-file': settings.oscap.content_path})
        Scapcontent.delete({'title': scap_content['title']})
        with pytest.raises(CLIReturnCodeError):
            Scapcontent.info({'title': scap_content['title']})
コード例 #24
0
    def test_positive_create_scap_content_with_valid_title(self, title):
        """Create scap-content with valid title

        :id: 68e9fbe2-e3c3-48e7-a774-f1260a3b7f4f

        :parametrized: yes

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created successfully.

        :BZ: 1471801

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent({
            'title':
            title,
            'scap-file':
            settings.oscap.content_path
        })
        assert scap_content['title'] == title
コード例 #25
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_delete_scap_content_with_id(self):
        """Delete a scap content with id as parameter

        :id: 11ae7652-65e0-4751-b1e0-246b27919238

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "delete" as sub-command.
            3. Pass ID as parameter.

        :expectedresults: The scap-content is deleted successfully.

        :CaseImportance: Critical
        """
        scap_content = make_scapcontent({
            'scap-file': '/tmp/{0}'.format(self.file_name)})
        Scapcontent.delete({'id': scap_content['id']})
        with self.assertRaises(CLIReturnCodeError):
            Scapcontent.info({'id': scap_content['id']})
コード例 #26
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_positive_create_scap_content_with_valid_title(self):
        """Create scap-content with valid title

        :id: 68e9fbe2-e3c3-48e7-a774-f1260a3b7f4f

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.

        :expectedresults: The scap-content is created successfully.

        :BZ: 1471801

        :CaseImportance: Critical
        """
        for title in valid_data_list():
            with self.subTest(title):
                scap_content = make_scapcontent({
                    'title': title,
                    'scap-file': '/tmp/{0}'.format(self.file_name)})
                self.assertEqual(scap_content['title'], title)
コード例 #27
0
ファイル: test_oscap.py プロジェクト: renzon/robottelo
 def setUpClass(cls):
     super(OpenScapTestCase, cls).setUpClass()
     _, cls.file_name = os.path.split(settings.oscap.content_path)
     # uploads the scap content to satellite
     ssh.upload_file(local_file=settings.oscap.content_path,
                     remote_file="/tmp/{0}".format(cls.file_name))
     cls.title = 'rhel-6-content'
     result = [
         scap['title'] for scap in Scapcontent.list()
         if scap.get('title') in cls.title
     ]
     if not result:
         make_scapcontent({
             'title': cls.title,
             'scap-file': '/tmp/{0}'.format(cls.file_name)
         })
     cls.scap_id_rhel6, cls.scap_profile_id_rhel6 = (
         cls.fetch_scap_and_profile_id(cls.title, OSCAP_PROFILE['common']))
コード例 #28
0
 def setUpClass(cls):
     super(OpenScapTestCase, cls).setUpClass()
     _, cls.file_name = os.path.split(settings.oscap.content_path)
     # uploads the scap content to satellite
     ssh.upload_file(local_file=settings.oscap.content_path,
                     remote_file="/tmp/{0}".format(cls.file_name))
     cls.title = gen_string('alpha')
     result = [
         scap['title'] for scap in Scapcontent.list()
         if scap.get('title') in cls.title
     ]
     if not result:
         make_scapcontent({
             'title': cls.title,
             'scap-file': '/tmp/{0}'.format(cls.file_name)
         })
     cls.scap_id_rhel6, cls.scap_profile_id_rhel6 = (
         cls.fetch_scap_and_profile_id(cls.title,
                                       OSCAP_PROFILE['security6']))
     Ansible.roles_import({'proxy-id': 1})
     Ansible.variables_import({'proxy-id': 1})
コード例 #29
0
    def test_negative_create_scap_content_with_same_title(self):
        """Create scap-content with same title

        :id: a8cbacc9-456a-4f6f-bd0e-4d1167a8b401

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.
            4. Execute "scap-content" command with "create" as sub-command
               with same title

        :expectedresults: The scap-content is not created.

        :BZ: 1474172

        :CaseAutomation: automated

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        scap_content = make_scapcontent({
            'title':
            title,
            'scap-file':
            '/tmp/{0}'.format(self.file_name)
        })
        self.assertEqual(scap_content['title'], title)
        with self.assertRaises(CLIFactoryError):
            make_scapcontent({
                'title': title,
                'scap-file': '/tmp/{0}'.format(self.file_name)
            })
コード例 #30
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
 def setUpClass(cls):
     super(OpenScapTestCase, cls).setUpClass()
     _, cls.file_name = os.path.split(settings.oscap.content_path)
     # uploads the scap content to satellite
     ssh.upload_file(
         local_file=settings.oscap.content_path,
         remote_file="/tmp/{0}".format(cls.file_name)
     )
     cls.title = 'rhel-6-content'
     result = [scap['title'] for scap in Scapcontent.list() if
               scap.get('title') in cls.title]
     if not result:
         make_scapcontent({
             'title': cls.title,
             'scap-file': '/tmp/{0}'.format(cls.file_name)
         })
     cls.scap_id_rhel6, cls.scap_profile_id_rhel6 = (
         cls.fetch_scap_and_profile_id(
             cls.title,
             OSCAP_PROFILE['common']
         )
     )
コード例 #31
0
ファイル: test_oscap.py プロジェクト: BlackSmith/robottelo
    def test_negative_create_scap_content_with_same_title(self):
        """Create scap-content with same title

        :id: a8cbacc9-456a-4f6f-bd0e-4d1167a8b401

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.
            3. Scap data stream ".xml" file.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Pass valid parameters.
            4. Execute "scap-content" command with "create" as sub-command
               with same title

        :expectedresults: The scap-content is not created.

        :BZ: 1474172

        :caseautomation: automated

        :CaseImportance: Critical
        """
        title = gen_string('alpha')
        scap_content = make_scapcontent({
            'title': title,
            'scap-file': '/tmp/{0}'.format(self.file_name)
        })
        self.assertEqual(scap_content['title'], title)
        with self.assertRaises(CLIFactoryError):
            make_scapcontent({
                'title': title,
                'scap-file': '/tmp/{0}'.format(self.file_name)
            })
コード例 #32
0
    def test_negative_create_scap_content_without_dsfile(self, title):
        """Create scap-content without scap data stream xml file

        :id: ea811994-12cd-4382-9382-37fa806cc26f

        :parametrized: yes

        :setup:

            1. Oscap should be enabled.
            2. Oscap-cli hammer plugin installed.

        :steps:

            1. Login to hammer shell.
            2. Execute "scap-content" command with "create" as sub-command.
            3. Don't pass the scap-file parameter.

        :expectedresults: The scap-content is not created.

        :CaseImportance: Critical
        """
        with pytest.raises(CLIFactoryError):
            make_scapcontent({'title': title})
コード例 #33
0
def scap_content(import_ansible_roles, import_puppet_classes):
    title = f"rhel-content-{gen_string('alpha')}"
    scap_info = make_scapcontent({'title': title, 'scap-file': f'{settings.oscap.content_path}'})
    scap_id = scap_info['id']
    scap_info = entities.ScapContents(id=scap_id).read()

    scap_profile_id = [
        profile['id']
        for profile in scap_info.scap_content_profiles
        if OSCAP_PROFILE['security7'] in profile['title']
    ][0]
    return {
        "title": title,
        "scap_id": scap_id,
        "scap_profile_id": scap_profile_id,
    }
コード例 #34
0
ファイル: test_host.py プロジェクト: vatsalparekh/robottelo
def scap_content():
    oscap_content_path = settings.oscap.content_path
    _, file_name = os.path.split(oscap_content_path)
    title = 'rhel-content-{0}'.format(gen_string('alpha'))
    ssh.upload_file(local_file=oscap_content_path,
                    remote_file="/tmp/{0}".format(file_name))
    scap_info = make_scapcontent({
        'title': title,
        'scap-file': '/tmp/{0}'.format(file_name)
    })
    scap_id = scap_info['id']
    scap_info = Scapcontent.info({'id': scap_id}, output_format='json')

    scap_profile_id = [
        profile['id'] for profile in scap_info['scap-content-profiles']
        if OSCAP_PROFILE['common'] in profile['title']
    ][0]
    return scap_id, scap_profile_id
コード例 #35
0
ファイル: test_host.py プロジェクト: jhutar/robottelo
def scap_content():
    oscap_content_path = settings.oscap.content_path
    _, file_name = os.path.split(oscap_content_path)
    title = 'rhel-content-{0}'.format(gen_string('alpha'))
    ssh.upload_file(
        local_file=oscap_content_path,
        remote_file="/tmp/{0}".format(file_name)
    )
    scap_info = make_scapcontent({
        'title': title,
        'scap-file': '/tmp/{0}'.format(file_name)
    })
    scap_id = scap_info['id']
    scap_info = Scapcontent.info({'id': scap_id}, output_format='json')

    scap_profile_id = [
        profile['id']
        for profile in scap_info['scap-content-profiles']
        if OSCAP_PROFILE['common'] in profile['title']
    ][0]
    return scap_id, scap_profile_id