Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def raiseit(*arg):
exc = deform.exception.ValidationFailure(None, None, None)
exc.render = lambda *arg: 'failure'
raise exc
inst.submit_success = raiseit
def raiseit(*arg):
exc = deform.exception.ValidationFailure(None, None, None)
exc.render = lambda *arg: 'failure'
raise exc
inst.submit_success = raiseit
def raiseit(*arg):
raise deform.exception.ValidationFailure(None, None, None)
inst.submit_success = raiseit
def test_create_add_upload_widget_if_request(self, inst, request_):
from deform.widget import FileUploadWidget
inst = inst.bind(request=request_)
assert isinstance(inst.widget, FileUploadWidget)
def test_sequence_wiget_is_set(self):
from deform.widget import SequenceWidget
inst = self.make_one()
assert isinstance(inst.widget, SequenceWidget)
def test_ipp_display_widget():
from pyipptool.widgets import IPPDisplayWidget
widget = IPPDisplayWidget()
rendrer = DummyRenderer()
field = DummyField(None, renderer=rendrer)
response = widget.serialize(field, None)
assert response == 'DISPLAY name'
def test_ipp_name_widget():
from pyipptool.widgets import IPPNameWidget
widget = IPPNameWidget()
rendrer = DummyRenderer()
schema = DummySchema(name='FOO')
field = DummyField(schema, renderer=rendrer)
field.parent = None
sub_field = DummyField(None, renderer=rendrer)
sub_field.parent = field
response = widget.serialize(sub_field, 'world')
assert response == 'NAME "FOO"'
def test_ipp_file_widget_with_None():
from pyipptool.widgets import IPPFileWidget
widget = IPPFileWidget()
rendrer = DummyRenderer()
field = DummyField(None, renderer=rendrer)
with pytest.raises(ValueError):
widget.serialize(field, None)
def test_ipp_group_widget():
from pyipptool.widgets import IPPGroupWidget
widget = IPPGroupWidget()
rendrer = DummyRenderer()
schema = DummySchema(name='FOO')
field = DummyField(schema, renderer=rendrer)
field.parent = None
sub_field = DummyField(None, renderer=rendrer)
sub_field.parent = field
response = widget.serialize(sub_field, 'world')
assert response == 'GROUP FOO'
def test_ipp_name_widget():
from pyipptool.widgets import IPPNameWidget
widget = IPPNameWidget()
rendrer = DummyRenderer()
schema = DummySchema(name='FOO')
field = DummyField(schema, renderer=rendrer)
field.parent = None
sub_field = DummyField(None, renderer=rendrer)
sub_field.parent = field
response = widget.serialize(sub_field, 'world')
assert response == 'NAME "FOO"'