'Verify correct validation and conversion of CSV strings'

def testValidationCSVSyntax(self):

    assertEqual = self.assertEqual
    assertNotEqual = self.assertNotEqual
    current.response.s3.bulk = True
    try:
        validator = IS_JSONS3()
        jsonstr = "{'a':    1}"
        (value, error) = validator(jsonstr)
        assertEqual(error, None)
        assertEqual(value, {'a': 1})
        jsonstr = '{\'a\':    \'this    ain\\\'t    a    good    "example"\'}'
        (value, error) = validator(jsonstr)
        assertEqual(error, None)
        assertEqual(value, {'a': 'this    ain\'t    a    good    "example"'})
        jsonstr = '{"a":    1}'
        (value, error) = validator(jsonstr)
        assertEqual(error, None)
        assertEqual(value, {'a': 1})
        jsonstr = 'not    valid'
        (value, error) = validator(jsonstr)
        assertNotEqual(error, None)
        assertEqual(value, jsonstr)
    finally:
        current.response.s3.bulk = False
