'Test the API for custom data storage'

def test_legacy_custom_data(self):

    (legacy, old) = (self.init_legacy(self.cloned_library), self.init_old(self.cloned_library))
    for name in (u'name1', u'name2', u'name3'):
        T = partial(ET, u'add_custom_book_data', old=old, legacy=legacy)
        T((1, name, u'val1'))(self)
        T((2, name, u'val2'))(self)
        T((3, name, u'val3'))(self)
        T = partial(ET, u'get_ids_for_custom_book_data', old=old, legacy=legacy)
        T((name,))(self)
        T = partial(ET, u'get_custom_book_data', old=old, legacy=legacy)
        T((1, name, object()))
        T((9, name, object()))
        T = partial(ET, u'get_all_custom_book_data', old=old, legacy=legacy)
        T((name, object()))
        T(((name + u'!'), object()))
        T = partial(ET, u'delete_custom_book_data', old=old, legacy=legacy)
        T((name, 1))
        T = partial(ET, u'get_all_custom_book_data', old=old, legacy=legacy)
        T((name, object()))
        T = partial(ET, u'delete_all_custom_book_data', old=old, legacy=legacy)
        T(name)
        T = partial(ET, u'get_all_custom_book_data', old=old, legacy=legacy)
        T((name, object()))
    T = partial(ET, u'add_multiple_custom_book_data', old=old, legacy=legacy)
    T((u'n', {1: u'val1', 2: u'val2'}))(self)
    T = partial(ET, u'get_all_custom_book_data', old=old, legacy=legacy)
    T((u'n', object()))
    old.close()
