def test_validate_empty():

    class User(wsgiservice.Resource):

        @wsgiservice.validate('id', doc='Foo')
        def POST(self, foo, id=5):
            return {'id': id, 'foo': foo}

    data = {'foo': 'bar', 'id': ''}
    req = webob.Request.blank('/', headers={'Accept': 'application/json',
                                            'Content-Type': 'application/json'},
                              method='POST', body=json.dumps(data))
    res = webob.Response()
    usr = User(request=req, response=res, path_params={})
    res = usr()
    print res
    assert res.status_int == 400
    obj = json.loads(res.body)
    print obj
    assert obj == {"error": "Value for id must not be empty."}
Generates an "editor" that is read-only.
dataset/ETHPy150Open pneff/wsgiservice/tests/test_resource_json.py/test_validate_empty--crossover with--dataset/ETHPy150Open enthought/traitsui/traitsui/editors/csv_list_editor.py/CSVListEditor.readonly_editor