Ejemplo n.º 1
0
    def test_message_type(self):
        """Test that we emit a message of the correct type for each reporter
        function."""

        for type_ in "notice", "warning", "error":
            err = ErrorBundle()
            err.report({"err_id": ("a", "b", "c"), type_: "Hello."})

            # Make sure we have this message in the list for the expected
            # message type.
            messages = getattr(err, "{0}s".format(type_))
            eq_(messages[0]["message"], "Hello.")

            # Make sure we only have this message in one place.
            eq_(len(err.notices + err.warnings + err.errors), 1)
Ejemplo n.º 2
0
    def test_message_type(self):
        """Test that we emit a message of the correct type for each reporter
        function."""

        for type_ in 'notice', 'warning', 'error':
            err = ErrorBundle()
            err.report({'err_id': ('a', 'b', 'c'), type_: 'Hello.'})

            # Make sure we have this message in the list for the expected
            # message type.
            messages = getattr(err, '{0}s'.format(type_))
            eq_(messages[0]['message'], 'Hello.')

            # Make sure we only have this message in one place.
            eq_(len(err.notices + err.warnings + err.errors), 1)