'Verify the response has the expected structure'

def verify_response_with_requested_fields(self, response):

    self.verify_response_block_dict(response)
    for (block_key_string, block_data) in response.data['blocks'].iteritems():
        block_key = deserialize_usage_key(block_key_string, self.course_key)
        xblock = self.store.get_item(block_key)
        self.assert_in_iff('children', block_data, xblock.has_children)
        self.assert_in_iff('graded', block_data, (xblock.graded is not None))
        self.assert_in_iff('format', block_data, (xblock.format is not None))
        self.assert_in_iff('due', block_data, (xblock.due is not None))
        self.assert_true_iff(block_data['student_view_multi_device'], (block_data['type'] == 'html'))
        self.assertNotIn('not_a_field', block_data)
        if xblock.has_children:
            self.assertSetEqual(set((unicode(child.location) for child in xblock.get_children())), set(block_data['children']))
