Ejemplo n.º 1
0
    def test_decorator_with_invalid_arg(self):
        """Decorators: keep_messages should not avoid the removal of flash-scoped values.
        """
        view = keep_messages("another_message")(view_method)
        self.assertEqual("Message", self.flash["message"])

        self.assertTrue(view(self.request))
        self.assertFalse("message" in self.flash)
Ejemplo n.º 2
0
    def test_decorator_with_invalid_arg(self):
        """Decorators: keep_messages should not avoid the removal of flash-scoped values.
        """
        view = keep_messages('another_message')(view_method)
        self.assertEqual('Message', self.flash['message'])

        self.assertTrue(view(self.request))
        self.assertFalse('message' in self.flash)
Ejemplo n.º 3
0
    def test_decorator_with_empty_args(self):
        """Decorators: keep_messages with empty args should avoid the removal of all flash-scoped values. 
        """
        view = keep_messages()(view_method)
        self.assertEqual("Message", self.flash["message"])

        self.assertTrue(view(self.request))
        self.assertEqual("Message", self.flash["message"])

        view_method(self.request)
        self.assertFalse("message" in self.flash)
Ejemplo n.º 4
0
    def test_decorator_with_empty_args(self):
        """Decorators: keep_messages with empty args should avoid the removal of all flash-scoped values. 
        """
        view = keep_messages()(view_method)
        self.assertEqual('Message', self.flash['message'])

        self.assertTrue(view(self.request))
        self.assertEqual('Message', self.flash['message'])

        view_method(self.request)
        self.assertFalse('message' in self.flash)
Ejemplo n.º 5
0
 def test_decorator_with_no_flash(self):
     """Decorators: keep_messages should not break when there's no flash scope attached to the request.
     """
     self.request = HttpRequest()
     view = keep_messages(view_method)
     self.assertFalse(view(self.request))
Ejemplo n.º 6
0
 def test_decorator_with_no_flash(self):
     """Decorators: keep_messages should not break when there's no flash scope attached to the request.
     """
     self.request = HttpRequest()
     view = keep_messages(view_method)
     self.assertFalse(view(self.request))