def sync(dbname, filename, update, remove_existing, verbose):
    S = couchdb.Server(host)
    if dbname not in S:
        raise ValueError("Database %r does not exist in %s"%(dbname, host))
    db = S[dbname]
    with open(filename, 'r') as f:
        categories = yaml.load(f)
    if verbose:
        print 'found %s root level category %r'%(len(categories), categories[0].keys())
    sync_categories.sync( db, categories, remove_existing=remove_existing, update=update, verbose=verbose )
 def test_categories_creation(self):
     categories_definition = yaml.load( open(DATADIR%'categories.yaml').read() )
     sync_categories.sync(self.db, categories_definition)