Example #1
0
    def setUp(self):
        super(ApiDeletePendingUserNotificationHandlerTest, self).setUp()
        self.handler = user_plugin.ApiDeletePendingUserNotificationHandler()
        self.client_id = self.SetupClient(0)

        with test_lib.FakeTime(self.TIME_0):
            notification.Notify(
                self.token.username,
                rdf_objects.UserNotification.Type.TYPE_CLIENT_INTERROGATED,
                "<some message>",
                rdf_objects.ObjectReference(
                    reference_type=rdf_objects.ObjectReference.Type.CLIENT,
                    client=rdf_objects.ClientReference(
                        client_id=self.client_id.Basename())))

            notification.Notify(
                self.token.username,
                rdf_objects.UserNotification.Type.TYPE_CLIENT_INTERROGATED,
                "<some message with identical time>",
                rdf_objects.ObjectReference(
                    reference_type=rdf_objects.ObjectReference.Type.CLIENT,
                    client=rdf_objects.ClientReference(
                        client_id=self.client_id.Basename())))

        with test_lib.FakeTime(self.TIME_1):
            notification.Notify(
                self.token.username,
                rdf_objects.UserNotification.Type.TYPE_CLIENT_APPROVAL_GRANTED,
                "<some other message>",
                rdf_objects.ObjectReference(
                    reference_type=rdf_objects.ObjectReference.Type.CLIENT,
                    client=rdf_objects.ClientReference(
                        client_id=self.client_id.Basename())))
Example #2
0
    def setUp(self):
        super(ApiDeletePendingUserNotificationHandlerTest, self).setUp()
        self.handler = user_plugin.ApiDeletePendingUserNotificationHandler()
        self.client_id = self.SetupClient(0)

        with test_lib.FakeTime(self.TIME_0):
            self._SendNotification(notification_type="Discovery",
                                   subject=str(self.client_id),
                                   message="<some message>",
                                   client_id=self.client_id)

            self._SendNotification(
                notification_type="Discovery",
                subject=str(self.client_id),
                message="<some message with identical time>",
                client_id=self.client_id)

        with test_lib.FakeTime(self.TIME_1):
            self._SendNotification(notification_type="ViewObject",
                                   subject=str(self.client_id),
                                   message="<some other message>",
                                   client_id=self.client_id)
 def DeletePendingUserNotification(self, args, token=None):
     return api_user.ApiDeletePendingUserNotificationHandler()