def setUp(self): db_fname = './entity_test_db' supp.gen_db(db_fname) cpool.cpool_init(db_fname, 5) p = model.Profile() p.name = 'Ayumi' self.pid = str(uuid.uuid1()) p.id = self.pid p.attr_dict['extra_info'] = 'something important' p.save()
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5) self.pada = da.ProfileAttrDA() row = ('nonsense_name', 'nonsense_value') self.pada.begin_transaction() self.pada.save_row(row) self.pada.end_transaction()
def testGenDB(self): db_fname = './support_test_db' supp.gen_db(db_fname) self.assertTrue(os.path.isfile(db_fname)) conn = sqlite3.connect(db_fname) conn.execute('select * from buddies;') conn.execute('select * from chat_log;') conn.execute('select * from exts;') conn.execute('select * from local_files;') conn.execute('select * from prof_attrs;') conn.execute('select * from buddy_extra;') conn.execute('select * from ext_prefs;') conn.execute('select * from file_tag;') conn.execute('select * from local_segs;') conn.execute('select * from tags;') conn.close()
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5) self.lfda = da.LocalFileDA() self.file_hash = 'file_hash' self.seg_hashs = ('seg_hash0', 'seg_hash1') row = (self.file_hash, 'full_name', 'name', 4096, '2009-01-01 09:09:09', 7168) seg_row0 = (self.seg_hashs[0], 0, self.file_hash, True) seg_row1 = (self.seg_hashs[1], 4096, self.file_hash, False) self.lfda.begin_transaction() self.lfda.save_row(row) self.lfda.save_seg_row(seg_row0) self.lfda.save_seg_row(seg_row1) self.lfda.end_transaction()
def add_profile(self, profile): profile._check_integrity() profile.db_fname = path.join(self.__prof_dir, profile.id) supp.gen_db(profile.db_fname) self.set_cur_profile(profile) profile.save()
def setUp(self): db_fname = './da_test_db' supp.gen_db(db_fname) cpool.cpool_release() cpool.cpool_init(db_fname, 5)