'Test error in component validation'

def testValidateComponentTableFailure(self):

    request = self.request
    crud = self.resource.crud
    jsonstr = '{"name":"",    "acronym":"test"}'
    request.body = StringIO(jsonstr)
    request.get_vars['component'] = 'office'
    output = crud.validate(request)
    self.assertTrue(isinstance(output, basestring))
    data = json.loads(output)
    self.assertTrue(isinstance(data, dict))
    self.assertEqual(len(data), 2)
    self.assertTrue(('name' in data))
    name = data['name']
    self.assertTrue(isinstance(name, dict))
    self.assertTrue(('value' in name))
    self.assertFalse(('text' in name))
    self.assertTrue(('_error' in name))
    self.assertTrue(('acronym' in data))
    acronym = data['acronym']
    self.assertTrue(isinstance(acronym, dict))
    self.assertTrue(('value' in acronym))
    self.assertFalse(('text' in acronym))
    self.assertTrue(('_error' in acronym))
