Exemplo n.º 1
0
    def test_messages_custom_msg_different_type(self):
        self.config.add_layer('test', path='tests:message/')

        add_message(self.request, 'message', 'test:custom')
        self.assertEqual(
            render_messages(self.request).strip(),
            '<div class="customMsg">message</div>')
Exemplo n.º 2
0
    def test_messages_custom_msg_different_type(self):
        self.config.add_layer(
            'test', path='tests:message/')

        add_message(self.request, 'message', 'test:custom')
        self.assertEqual(
            render_messages(self.request).strip(),
            '<div class="customMsg">message</div>')
Exemplo n.º 3
0
    def test_messages_addmessage(self):
        add_message(self.request, 'message')

        res = render_messages(self.request).strip()

        self.assertEqual(
            res,
            text_('<div class="alert alert-info">\n  <a class="close" data-dismiss="alert">×</a>\n  message\n</div>','utf-8'))
Exemplo n.º 4
0
    def test_messages_warning_msg(self):
        add_message(self.request, 'warning', 'warning')

        self.assertEqual(
            render_messages(self.request).strip(),
            text_(
                '<div class="alert alert-warning">\n  <a class="close" data-dismiss="alert">×</a>\n  warning\n</div>',
                'utf-8'))
Exemplo n.º 5
0
    def test_messages_addmessage(self):
        add_message(self.request, 'message')

        res = render_messages(self.request).strip()

        self.assertEqual(
            res,
            text_(
                '<div class="alert alert-info">\n  <a class="close" data-dismiss="alert">×</a>\n  message\n</div>',
                'utf-8'))
Exemplo n.º 6
0
    def test_messages_error_msg(self):
        add_message(self.request, 'error', 'error')

        self.assertEqual(
            render_messages(self.request).strip(),
            text_('<div class="alert alert-error alert-danger">\n  <a class="close" data-dismiss="alert">×</a>\n  error\n</div>','utf-8'))

        add_message(self.request, ValueError('Error'), 'error')
        self.assertEqual(
            render_messages(self.request).strip(),
            text_('<div class="alert alert-error alert-danger">\n  <a class="close" data-dismiss="alert">×</a>\n  ValueError: Error\n</div>','utf-8'))
Exemplo n.º 7
0
    def test_messages_error_msg(self):
        add_message(self.request, 'error', 'error')

        self.assertEqual(
            render_messages(self.request).strip(),
            text_(
                '<div class="alert alert-error alert-danger">\n  <a class="close" data-dismiss="alert">×</a>\n  error\n</div>',
                'utf-8'))

        add_message(self.request, ValueError('Error'), 'error')
        self.assertEqual(
            render_messages(self.request).strip(),
            text_(
                '<div class="alert alert-error alert-danger">\n  <a class="close" data-dismiss="alert">×</a>\n  ValueError: Error\n</div>',
                'utf-8'))
Exemplo n.º 8
0
    def test_multi_error(self):
        add_message(self.request, ['error1', ValueError('error2')], 'error')

        res = render_messages(self.request)
        self.assertIn('error1', res)
        self.assertIn('ValueError: error2', res)
Exemplo n.º 9
0
    def test_messages_warning_msg(self):
        add_message(self.request, 'warning', 'warning')

        self.assertEqual(
            render_messages(self.request).strip(),
            text_('<div class="alert alert-warning">\n  <a class="close" data-dismiss="alert">×</a>\n  warning\n</div>','utf-8'))
Exemplo n.º 10
0
    def test_multi_error(self):
        add_message(self.request, ['error1', ValueError('error2')], 'error')

        res = render_messages(self.request)
        self.assertIn('error1', res)
        self.assertIn('ValueError: error2', res)