def test_non_readable_filedescriptor(self):
        entry = Problems2Entry(self.bus, self.p2_entry_path)

        with open_fd("/etc/passwd", os.O_PATH) as fd:
            entry.SaveElements({"passwd": dbus.types.UnixFd(fd)}, 0)
            data = entry.ReadElements(["passwd"], 0x0)
            self.assertNotIn("passwd", data)
Exemple #2
0
    def test_non_readable_filedescriptor(self):
        with open_fd("/etc/passwd", os.O_PATH) as fd:
            description = {"analyzer": "problems2testsuite_analyzer",
                           "reason": "Application has been killed",
                           "backtrace": "die()",
                           "duphash": "NOT_READABLE_FD",
                           "uuid": "NOT_READABLE_FD",
                           "passwd": dbus.types.UnixFd(fd),
                           "executable": "/usr/bin/foo",
                           "type": "abrt-problems2-sanity"}

            task_path = self.p2.NewProblem(description, 0x1)
            self.assertRaisesProblems2Exception(
                    "Failed to create new "
                    "problem directory: Failed to set file file descriptor of "
                    "the 'passwd' item non-blocking",
                    wait_for_task_new_problem, self, self.bus, task_path)