示例#1
0
 def test_open_existing(self):
     db = sqlite.SQLitePartialExpandDatabase(self.db_path)
     self.addCleanup(db.close)
     doc = db.create_doc_from_json(tests.simple_doc)
     # Even though create=True, we shouldn't wipe the db
     db2 = u1db_open(self.db_path, create=True)
     self.addCleanup(db2.close)
     doc2 = db2.get_doc(doc.doc_id)
     self.assertEqual(doc, doc2)
示例#2
0
 def test_open_existing(self):
     db = sqlite.SQLitePartialExpandDatabase(self.db_path)
     self.addCleanup(db.close)
     doc = db.create_doc_from_json(tests.simple_doc)
     # Even though create=True, we shouldn't wipe the db
     db2 = u1db_open(self.db_path, create=True)
     self.addCleanup(db2.close)
     doc2 = db2.get_doc(doc.doc_id)
     self.assertEqual(doc, doc2)
示例#3
0
 def test_open_existing_no_create(self):
     db = sqlite.SQLitePartialExpandDatabase(self.db_path)
     self.addCleanup(db.close)
     db2 = u1db_open(self.db_path, create=False)
     self.addCleanup(db2.close)
     self.assertIsInstance(db2, sqlite.SQLitePartialExpandDatabase)
示例#4
0
 def test_open_with_factory(self):
     db = u1db_open(self.db_path,
                    create=True,
                    document_factory=TestAlternativeDocument)
     self.addCleanup(db.close)
     self.assertEqual(TestAlternativeDocument, db._factory)
示例#5
0
 def test_open_create(self):
     db = u1db_open(self.db_path, create=True)
     self.addCleanup(db.close)
     self.assertTrue(os.path.exists(self.db_path))
     self.assertIsInstance(db, sqlite.SQLiteDatabase)
示例#6
0
 def test_open_existing_no_create(self):
     db = sqlite.SQLitePartialExpandDatabase(self.db_path)
     self.addCleanup(db.close)
     db2 = u1db_open(self.db_path, create=False)
     self.addCleanup(db2.close)
     self.assertIsInstance(db2, sqlite.SQLitePartialExpandDatabase)
示例#7
0
 def test_open_with_factory(self):
     db = u1db_open(self.db_path, create=True,
                    document_factory=TestAlternativeDocument)
     self.addCleanup(db.close)
     self.assertEqual(TestAlternativeDocument, db._factory)
示例#8
0
 def test_open_create(self):
     db = u1db_open(self.db_path, create=True)
     self.addCleanup(db.close)
     self.assertTrue(os.path.exists(self.db_path))
     self.assertIsInstance(db, sqlite.SQLiteDatabase)