'Testing whether the API returns the correct blocks'

@deferred(timeout=10)
def test_get_blocks(self):

    def verify_response(response):
        response_json = json.loads(response)
        self.assertEqual(len(response_json['blocks']), 1)
    test_block = TestBlock()
    self.tc_community.persistence.add_block(test_block)
    self.should_check_equality = False
    return self.do_request(('trustchain/blocks/%s?limit=10' % test_block.public_key.encode('HEX')), expected_code=200).addCallback(verify_response)
