def test_db(self): data = ('testKey', 'testVal') cogdb = Cog("/tmp/" + DIR_NAME + "/test") cogdb.create_namespace("test") cogdb.create_table("db_test", "test") cogdb.put(data) self.assertEqual(cogdb.get("testKey"), ('0', ('testKey', 'testVal')))
def test_db(self): data = Record('testKey','testVal') cogdb = Cog() cogdb.create_namespace("test") cogdb.create_table("db_test", "test") cogdb.put(data) self.assertTrue(cogdb.get("testKey").is_equal_val(Record('testKey', 'testVal'))) cogdb.close()
def test_db(self): data = ('user100', '{"firstname":"Hari","lastname":"seldon"}') cogdb = Cog(config=config) cogdb.create_namespace("test") cogdb.create_table("db_test", "test") cogdb.put(data) scanner = cogdb.scanner() for r in scanner: print r
def test_db(self): data = ('user100', '{"firstname":"Hari","lastname":"seldon"}') cogdb = Cog(config=config) cogdb.create_namespace("test") cogdb.create_or_load_table("db_test", "test") cogdb.put(data) scanner = cogdb.scanner() for r in scanner: res = r self.assertEqual( res, ('user100', '{"firstname":"Hari","lastname":"seldon"}'))
def test_db(self): data = Record('user100','{"firstname":"Hari","lastname":"seldon"}') cogdb = Cog() cogdb.create_namespace("test") cogdb.create_table("db_test", "test") cogdb.put(data) scanner = cogdb.scanner() res = None for r in scanner: res = r print(res) self.assertTrue(data.is_equal_val(res)) cogdb.close()
def test_db(self): db_path = '/tmp/cogtestdb2' try: os.makedirs(db_path) except OSError: if not os.path.isdir(db_path): raise config.CUSTOM_COG_DB_PATH = db_path cogdb = Cog() # create a namespace cogdb.create_namespace("my_namespace") # create new table cogdb.create_table("new_db", "my_namespace") # put some data cogdb.put(Record('A', 'val')) cogdb.put(Record('B', 'val')) cogdb.put(Record('key3', 'val')) cogdb.put(Record('key3', 'val_updated')) self.assertEqual(cogdb.get('key3').value, 'val_updated') cogdb.close()
def test_db(self): cogdb = Cog('/tmp/cogtestdb2') # create a namespace cogdb.create_namespace("my_namespace") # create new table cogdb.create_or_load_table("new_db", "my_namespace") # put some data cogdb.put(('A', 'val')) cogdb.put(('B', 'val')) cogdb.put(('key3', 'val')) cogdb.put(('key3', 'val_updated')) self.assertEqual(cogdb.get('key3')[1][1], 'val_updated')