Exemplo n.º 1
0
 def test_multiple_types(self):
     tdb = TemporaryDatabase("txn:git:hash\n")
     ddir = tdb.ddir
     db = Database.load(ddir.name)
     db.records()[:] = [Record([1, 2, 3])]
     db.store()
     self.assertEqual(set(db.schema().transaction_types()),
                      set(["git", "hash"]))
Exemplo n.º 2
0
 def do_test(self, expected, schema, configv):
     tdb = TemporaryDatabase(schema)
     ddir2 = tempfile.TemporaryDirectory()
     config = "%s/config" % ddir2.name
     with open(config, "w") as fp:
         fp.write("fmt:3:newfol config file:\n" + configv)
     db = Database.load(tdb.ddir.name, extra_config=[config])
     db.records()[:] = [Record([1, 2, 3])]
     db.store()
     self.assertEqual(db.schema().execution_allowed(), expected)
     ddir2.cleanup()
Exemplo n.º 3
0
 def test_existing_config_file(self):
     tdb = TemporaryDatabase()
     ddir2 = tempfile.TemporaryDirectory()
     config = "%s/config" % ddir2.name
     with open(config, "w") as fp:
         fp.write("fmt:3:newfol config file:\ntxn:git:hash\n")
     db = Database.load(tdb.ddir.name, extra_config=[config])
     db.records()[:] = [Record([1, 2, 3])]
     db.store()
     self.assertEqual(set(db.schema().transaction_types()),
                      set(["git", "hash"]))
     ddir2.cleanup()
Exemplo n.º 4
0
 def db(self):
     return Database.load(self.ddir.name)
Exemplo n.º 5
0
 def test_missing_config_file(self):
     tdb = TemporaryDatabase()
     config = "%s/config" % tdb.ddir.name
     db = Database.load(tdb.ddir.name, extra_config=[config])
     db.records()[:] = [Record([1, 2, 3])]
     db.store()