Example #1
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})
Example #2
0
    def test_negative_list_default_content_with_viewer_role(
            self, scap_content, default_viewer_role):
        """List the default scap content by user with viewer role

        :id: 1e909ffc-10d9-4bcd-b4bb-c26981912bb4

        :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 viewer role.
            2. Execute the scap-content command with list as sub-Command.
            3. Execute the "scap-content" command with info as sub-command.
            4. Pass valid parameters.

        :expectedresults: The scap-content and it's info is not listed.

        :CaseImportance: Critical
        """
        result = Scapcontent.with_user(default_viewer_role.login,
                                       default_viewer_role.password).list()
        assert len(result) == 0
        with pytest.raises(CLIReturnCodeError):
            Scapcontent.with_user(default_viewer_role.login,
                                  default_viewer_role.password).info(
                                      {'title': scap_content['title']})
Example #3
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})
Example #4
0
    def test_negative_list_default_content_with_viewer_role(self):
        """List the default scap content by user with viewer role

        :id: 1e909ffc-10d9-4bcd-b4bb-c26981912bb4

        :setup:

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

        :steps:

            1. Login to shell from user account.
            2. Execute the scap-content command with list as sub-Command.

        :expectedresults: The scap-content is not listed.

        :caseautomation: automated

        :CaseImportance: Critical
        """
        login, password = self.create_test_user_viewer_role()
        result = Scapcontent.with_user(login, password).list()
        self.assertEqual(len(result), 0)
Example #5
0
    def test_negative_list_default_content_with_viewer_role(self):
        """List the default scap content by user with viewer role

        :id: 1e909ffc-10d9-4bcd-b4bb-c26981912bb4

        :setup:

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

        :steps:

            1. Login to shell from user account.
            2. Execute the scap-content command with list as sub-Command.

        :expectedresults: The scap-content is not listed.

        :CaseImportance: Critical
        """
        login, password = self.create_test_user_viewer_role()
        result = Scapcontent.with_user(login, password).list()
        self.assertEqual(len(result), 0)