Пример #1
0
    def test_get_or_insert_content(self):
        with TempDir() as tmpdir:
            db_name = os.path.join(tmpdir.name, "files.sdb")
            the_db = Database(db_name, verbose=0)
            content = Content(1024, "hash1", "hash2", "hash3", 1)
            self.assertEqual(the_db.get_or_insert_content(content), 1)

            content = Content(1024, "hash1", "hash2", "hash3", 1)
            self.assertEqual(the_db.get_or_insert_content(content), 1)