Beispiel #1
0
    def test_none(self):
        """Empty notes should be OK, since we will populate with a default text."""
        request = mock.Mock()
        request.errors = Errors()
        request.validated = {'notes': None}

        validators.validate_override_notes(request)

        assert not len(request.errors)
Beispiel #2
0
    def test_length_above_range(self):
        """We don't allow too verbose notes."""
        request = mock.Mock()
        request.errors = Errors()
        request.validated = {
            'notes': 'n' * 2001}

        validators.validate_override_notes(request)

        assert request.errors == [
            {'location': 'body', 'name': 'notes',
             'description': 'Notes may not contain more than 2000 chars'}
        ]
        assert request.errors.status == exceptions.HTTPBadRequest.code