8 import CondCore.Utilities.CondDBFW.querying
as querying
9 import CondCore.Utilities.CondDBFW.data_sources
as data_sources
10 import CondCore.Utilities.CondDBFW.data_formats
as data_formats
11 import CondCore.Utilities.CondDBFW.shell
as shell
12 import CondCore.Utilities.CondDBFW.models
as models
14 prod_connection_string =
"frontier://FrontierProd/CMS_CONDITIONS" 23 self.
payload = self.connection.payload(hash=
"00172cd62d8abae41915978d815ae62cc08ad8b9")
24 if not(os.path.isfile(
"test_suite.sqlite")):
26 handle = open(
"test_suite.sqlite",
"w")
29 if os.path.isfile(
"simple_conditions_schema.sql"):
31 process = subprocess.Popen(
"sqlite3 test_suite.sqlite < simple_conditions_schema.sql")
32 result = process.communicate()[0]
33 except Exception
as e:
38 recomputed_hash = hashlib.sha1(self.payload.object_type)
39 recomputed_hash.update(self.payload.data)
40 recomputed_hash = recomputed_hash.hexdigest()
41 self.assertEqual(recomputed_hash, self.payload.hash)
48 sqlite_con.write_and_commit(self.
payload)
50 sqlite_payload = sqlite_con.payload(hash=self.payload.hash)
51 self.assertEqual(sqlite_payload.data, self.payload.data)
53 tmp_sqlite_connection = sqlite_con.engine.connect()
54 result = tmp_sqlite_connection.execute(
"delete from payload where hash=?", self.payload.hash)
55 tmp_sqlite_connection.close()
58 payload_in_sqlite = sqlite_con.payload(hash=self.payload.hash)
59 self.assertEqual(payload_in_sqlite,
None)
def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True)
def test_recomputed_hash(self)
test_write_blob_to_sqlite