Beispiel #1
0
 def test_list_tables(self):
     cogdb = Cog(config=config)
     cogdb.create_namespace("test_ns")
     cogdb.create_or_load_table("table1", "test_ns")
     cogdb.create_or_load_table("table2", "test_ns")
     cogdb.create_or_load_table("table3", "test_ns")
     self.assertEquals(cogdb.list_tables(), ['table2', 'table3', 'table1'])
Beispiel #2
0
 def test_db(self):
     data = ('testKey','testVal')
     cogdb = Cog("/tmp/"+DIR_NAME+"/test")
     cogdb.create_namespace("test")
     cogdb.create_or_load_table("db_test", "test")
     cogdb.put(data)
     self.assertEqual(cogdb.get("testKey"), ('0', ('testKey', 'testVal')))\
Beispiel #3
0
 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"}'))
Beispiel #4
0
    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')