'Assert that the response had status 200 and returned a valid
JSON-parseable dict.
If success is provided, assert that the response had that
value for \'success\' in the JSON dict.
If value is provided, assert that the response contained that
value for \'value\' in the JSON dict.'

def _assert_response(self, response, success=None, value=None):

    self.assertEqual(response.status_code, 200)
    try:
        response_dict = json.loads(response.content)
    except ValueError:
        self.fail(('Could    not    parse    response    content    as    JSON:    %s' % str(response.content)))
    if (success is not None):
        self.assertEqual(response_dict['success'], success)
    if (value is not None):
        msg = ("'%s'    did    not    contain    '%s'" % (unicode(response_dict['value']), unicode(value)))
        self.assertIn(value, response_dict['value'], msg)
