Beispiel #1
0
    def test_initial_not_in_EMPTY_VALUES_and_value_is_not_equal_to_initial(
            self):

        field = HoneypotField(initial='foobar')

        with self.assertRaises(ValidationError):
            field.clean('pizza')
Beispiel #2
0
    def test_initial_not_in_EMPTY_VALUES_and_value_is_equal_to_initial(self):

        field = HoneypotField(initial='foobar')

        output = field.clean('foobar')

        self.assertEqual(output, 'foobar')
Beispiel #3
0
    def test_initial_and_value_in_EMPTY_VALUES(self):

        field = HoneypotField(initial=None)

        output = field.clean('')

        self.assertEqual(output, '')
Beispiel #4
0
    def test_initial_not_in_EMPTY_VALUES_and_value_is_not_equal_to_initial(self
                                                                           ):

        field = HoneypotField(initial='foobar')

        with self.assertRaises(ValidationError):
            field.clean('pizza')
Beispiel #5
0
    def test_initial_not_in_EMPTY_VALUES_and_value_is_equal_to_initial(self):

        field = HoneypotField(initial='foobar')

        output = field.clean('foobar')

        self.assertEqual(output, 'foobar')
Beispiel #6
0
    def test_initial_and_value_in_EMPTY_VALUES(self):

        field = HoneypotField(initial=None)

        output = field.clean('')

        self.assertEqual(output, '')
Beispiel #7
0
    def test_class_of_widget(self):
        field = HoneypotField()

        self.assertIsInstance(field.widget, HoneypotWidget)