CMS 3D CMS Logo

List of all members | Public Member Functions | Public Attributes
payload_tests.payload_tests Class Reference
Inheritance diagram for payload_tests.payload_tests:

Public Member Functions

def setUp (self)
 
def test_recomputed_hash (self)
 
def test_write_blob_to_sqlite (self)
 

Public Attributes

 connection
 
 payload
 
 test_write_blob_to_sqlite
 

Detailed Description

Definition at line 17 of file payload_tests.py.

Member Function Documentation

◆ setUp()

def payload_tests.payload_tests.setUp (   self)

Definition at line 19 of file payload_tests.py.

19  def setUp(self):
20  # set up a connection to oracle
21  self.connection = querying.connect(prod_connection_string, map_blobs=True, secrets=secrets_source)
22  # get a payload
23  self.payload = self.connection.payload(hash="00172cd62d8abae41915978d815ae62cc08ad8b9")
24  if not(os.path.isfile("test_suite.sqlite")):
25  # create file
26  handle = open("test_suite.sqlite", "w")
27  handle.close()
28  # insert schema
29  if os.path.isfile("simple_conditions_schema.sql"):
30  try:
31  process = subprocess.Popen("sqlite3 test_suite.sqlite < simple_conditions_schema.sql")
32  result = process.communicate()[0]
33  except Exception as e:
34  self.test_write_blob_to_sqlite = unittest.skip("Can't setup sqlite database file.")(self.test_write_blob_to_sqlite)
35 

◆ test_recomputed_hash()

def payload_tests.payload_tests.test_recomputed_hash (   self)

Definition at line 36 of file payload_tests.py.

36  def test_recomputed_hash(self):
37  import hashlib
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)
42 

References payload_tests.payload_tests.payload, and popcon::PopConSourceHandler< T >::Triplet.payload.

◆ test_write_blob_to_sqlite()

def payload_tests.payload_tests.test_write_blob_to_sqlite (   self)

Definition at line 43 of file payload_tests.py.

43  def test_write_blob_to_sqlite(self):
44  import os
45  # open sqlite file in CondDBFW
46  sqlite_con = querying.connect("sqlite://test_suite.sqlite", map_blobs=True)
47  # write to sqlite file
48  sqlite_con.write_and_commit(self.payload)
49  # read payload from sqlite file, check for equality between blobs
50  sqlite_payload = sqlite_con.payload(hash=self.payload.hash)
51  self.assertEqual(sqlite_payload.data, self.payload.data)
52  # delete payload from sqlite file
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()
56 
57  # check that payload isn't in sqlite anymore
58  payload_in_sqlite = sqlite_con.payload(hash=self.payload.hash)
59  self.assertEqual(payload_in_sqlite, None)

References querying.connect(), payload_tests.payload_tests.payload, popcon::PopConSourceHandler< T >::Triplet.payload, and payload_tests.payload_tests.test_write_blob_to_sqlite.

Member Data Documentation

◆ connection

payload_tests.payload_tests.connection

◆ payload

payload_tests.payload_tests.payload

◆ test_write_blob_to_sqlite

payload_tests.payload_tests.test_write_blob_to_sqlite
querying.connect
def connect(connection_data, mode="r", map_blobs=False, secrets=None, pooling=True)
Definition: querying.py:452
jets_cff.payload
payload
Definition: jets_cff.py:32