'Assert that the bookmark data matches the data in the model.'

def assert_bookmark_data_is_valid(self, bookmark, bookmark_data, check_optional_fields=False):

    self.assertEqual(bookmark_data['id'], bookmark.resource_id)
    self.assertEqual(bookmark_data['course_id'], unicode(bookmark.course_key))
    self.assertEqual(bookmark_data['usage_id'], unicode(bookmark.usage_key))
    self.assertEqual(bookmark_data['block_type'], unicode(bookmark.usage_key.block_type))
    self.assertIsNotNone(bookmark_data['created'])
    if check_optional_fields:
        self.assertEqual(bookmark_data['display_name'], bookmark.display_name)
        self.assertEqual(bookmark_data['path'], bookmark.path)
