Beispiel #1
0
    def test_task_stopped_task_destroyed_with_session(self):
        pbus = dbus.SystemBus(private=True)
        p2_proxy = pbus.get_object(BUS_NAME,
                                   '/org/freedesktop/Problems2')
        p2 = dbus.Interface(p2_proxy,
                            dbus_interface='org.freedesktop.Problems2')

        description = {"analyzer": "problems2testsuite_analyzer",
                       "reason": "Application has been killed",
                       "backtrace": "die()",
                       "duphash": "TASK_NEW_PROBLEM_SESSION",
                       "uuid": "TASK_NEW_PROBLEM_SESSION",
                       "executable": "/usr/bin/foo",
                       "type": "abrt-problems2-stopped-destroyed-with-session"}

        # Create task, run it and stop after temporary entry is created
        task_path = p2.NewProblem(description, 0x1 | 0x2 | 0x4)

        self.bus.get_object(BUS_NAME, task_path)
        wait_for_task_status(self, pbus, task_path, 2)

        pbus.close()

        task = Problems2Task(self.bus, task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.UnknownMethod: No such interface "
            "'org.freedesktop.DBus.Properties' on object at path " + task_path,
            task.getproperty, "Status")
Beispiel #2
0
    def test_task_stopped_task_destroyed_with_session(self):
        pbus = dbus.SystemBus(private=True)
        p2_proxy = pbus.get_object(BUS_NAME, '/org/freedesktop/Problems2')
        p2 = dbus.Interface(p2_proxy,
                            dbus_interface='org.freedesktop.Problems2')

        description = {
            "analyzer": "problems2testsuite_analyzer",
            "reason": "Application has been killed",
            "backtrace": "die()",
            "duphash": "TASK_NEW_PROBLEM_SESSION",
            "uuid": "TASK_NEW_PROBLEM_SESSION",
            "executable": "/usr/bin/foo",
            "type": "abrt-problems2-stopped-destroyed-with-session"
        }

        # Create task, run it and stop after temporary entry is created
        task_path = p2.NewProblem(description, 0x1 | 0x2 | 0x4)

        self.bus.get_object(BUS_NAME, task_path)
        wait_for_task_status(self, pbus, task_path, 2)

        pbus.close()

        task = Problems2Task(self.bus, task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.UnknownMethod: No such interface "
            "'org.freedesktop.DBus.Properties' on object at path " + task_path,
            task.getproperty, "Status")
Beispiel #3
0
    def test_get_new_foreign_problem(self):
        description = {"analyzer": "problems2testsuite_analyzer",
                       "reason": "Application has been killed",
                       "backtrace": "die()",
                       "duphash": "TASK_NEW_PROBLEM",
                       "uuid": "TASK_NEW_PROBLEM",
                       "executable": "/usr/bin/foo",
                       "type": "abrt-problems2"}

        # Create task, run it and stop after temporary entry is created
        task_path = self.root_p2.NewProblem(description, 0x1 | 0x2 | 0x4)
        task = wait_for_task_status(self, self.root_bus, task_path, 2)

        details = task.getproperty("Details")
        self.assertIn("NewProblem.TemporaryEntry", details)

        new_problems = self.p2.GetProblems(0x1 | 0x2, dict())
        self.assertIn(details["NewProblem.TemporaryEntry"], new_problems)

        task.Cancel(0)

        time.sleep(1)

        new_problems = self.p2.GetProblems(0x1 | 0x2, dict())
        self.assertEqual(0, len(new_problems))
Beispiel #4
0
    def test_accessible_to_own_session_only(self):
        description = {"analyzer": "problems2testsuite_analyzer",
                       "reason": "Application has been killed",
                       "backtrace": "die()",
                       "duphash": "TASK_NEW_PROBLEM_SESSION",
                       "uuid": "TASK_NEW_PROBLEM_SESSION",
                       "executable": "/usr/bin/foo",
                       "type": "abrt-problems2-accessible-to-own-session"}

        # Create task, run it and stop after temporary entry is created
        root_task_path = self.root_p2.NewProblem(description, 0x1 | 0x2 | 0x4)
        root_task = wait_for_task_status(self,
                                         self.root_bus,
                                         root_task_path,
                                         2)

        task = Problems2Task(self.bus, root_task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.AccessDenied: "
            "The task does not belong to your session",
            task.getproperty, "Status")

        root_task.Cancel(0)

        # let abrt-dbus finish its work load
        time.sleep(1)
Beispiel #5
0
    def test_accessible_to_own_session_only(self):
        description = {
            "analyzer": "problems2testsuite_analyzer",
            "reason": "Application has been killed",
            "backtrace": "die()",
            "duphash": "TASK_NEW_PROBLEM_SESSION",
            "uuid": "TASK_NEW_PROBLEM_SESSION",
            "executable": "/usr/bin/foo",
            "type": "abrt-problems2-accessible-to-own-session"
        }

        # Create task, run it and stop after temporary entry is created
        root_task_path = self.root_p2.NewProblem(description, 0x1 | 0x2 | 0x4)
        root_task = wait_for_task_status(self, self.root_bus, root_task_path,
                                         2)

        task = Problems2Task(self.bus, root_task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.AccessDenied: "
            "The task does not belong to your session", task.getproperty,
            "Status")

        root_task.Cancel(0)

        # let abrt-dbus finish its work load
        time.sleep(1)
Beispiel #6
0
    def test_get_new_foreign_problem(self):
        description = {"analyzer": "problems2testsuite_analyzer",
                       "reason": "Application has been killed",
                       "backtrace": "die()",
                       "duphash": "TASK_NEW_PROBLEM",
                       "uuid": "TASK_NEW_PROBLEM",
                       "executable": "/usr/bin/foo",
                       "type": "abrt-problems2"}

        # Create task, run it and stop after temporary entry is created
        task_path = self.root_p2.NewProblem(description, 0x1 | 0x2 | 0x4)
        task = wait_for_task_status(self, self.root_bus, task_path, 2)

        details = task.getproperty("Details")
        self.assertIn("NewProblem.TemporaryEntry", details)

        new_problems = self.p2.GetProblems(0x1 | 0x2, dict())
        self.assertIn(details["NewProblem.TemporaryEntry"], new_problems)

        task.Cancel(0)

        time.sleep(1)

        new_problems = self.p2.GetProblems(0x1 | 0x2, dict())
        self.assertEquals(0, len(new_problems))
Beispiel #7
0
    def test_task_done_task_destroyed_with_session(self):
        old_problems = set(self.p2.GetProblems(0, dict()))

        pbus = dbus.SystemBus(private=True)
        p2_proxy = pbus.get_object(BUS_NAME, '/org/freedesktop/Problems2')
        p2 = dbus.Interface(p2_proxy,
                            dbus_interface='org.freedesktop.Problems2')

        description = {
            "analyzer": "problems2testsuite_analyzer",
            "reason": "Application has been killed",
            "backtrace": "die()",
            "duphash": "TASK_NEW_PROBLEM_SESSION",
            "uuid": "TASK_NEW_PROBLEM_SESSION",
            "executable": "/usr/bin/foo",
            "type": "abrt-problems2-dd-with-session"
        }

        # Create task, run it
        task_path = p2.NewProblem(description, 0x1 | 0x4)

        self.bus.get_object(BUS_NAME, task_path)
        wait_for_task_status(self, pbus, task_path, 5)

        pbus.close()

        task = Problems2Task(self.bus, task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.UnknownMethod: No such interface "
            "'org.freedesktop.DBus.Properties' on object at path " + task_path,
            task.getproperty, "Status")

        new_problems = self.p2.GetProblems(0, dict())
        to_delete = list()
        for p in new_problems:
            if p in old_problems:
                continue
            to_delete.append(p)

        self.assertTrue(to_delete)
        self.p2.DeleteProblems(to_delete)
Beispiel #8
0
    def test_task_done_task_destroyed_with_session(self):
        old_problems = set(self.p2.GetProblems(0, dict()))

        pbus = dbus.SystemBus(private=True)
        p2_proxy = pbus.get_object(BUS_NAME,
                                   '/org/freedesktop/Problems2')
        p2 = dbus.Interface(p2_proxy,
                            dbus_interface='org.freedesktop.Problems2')

        description = {"analyzer": "problems2testsuite_analyzer",
                       "reason": "Application has been killed",
                       "backtrace": "die()",
                       "duphash": "TASK_NEW_PROBLEM_SESSION",
                       "uuid": "TASK_NEW_PROBLEM_SESSION",
                       "executable": "/usr/bin/foo",
                       "type": "abrt-problems2-dd-with-session"}

        # Create task, run it
        task_path = p2.NewProblem(description, 0x1 | 0x4)

        self.bus.get_object(BUS_NAME, task_path)
        wait_for_task_status(self, pbus, task_path, 5)

        pbus.close()

        task = Problems2Task(self.bus, task_path)
        self.assertRaisesDBusError(
            "org.freedesktop.DBus.Error.UnknownMethod: No such interface "
            "'org.freedesktop.DBus.Properties' on object at path " + task_path,
            task.getproperty, "Status")

        new_problems = self.p2.GetProblems(0, dict())
        to_delete = list()
        for p in new_problems:
            if p in old_problems:
                continue
            to_delete.append(p)

        self.assertTrue(to_delete)
        self.p2.DeleteProblems(to_delete)