Esempio n. 1
0
 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')))
Esempio n. 2
0
    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()
Esempio n. 3
0
 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()
Esempio n. 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')