Exemplo n.º 1
0
 def test_select_inv_ids_3(self, pg_db_conn):
     """Test select inventory_ids with empty repo collection"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         repos = []
         BaseView.select_repo_based_inventory_ids(cur, repos)
         assert list(cur.fetchall()) == []
Exemplo n.º 2
0
 def test_select_inv_ids_2(self, pg_db_conn):
     """Test select inventory_ids repo collection"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         repos = ["repo1"]
         BaseView.select_repo_based_inventory_ids(cur, repos)
         assert len(cur.fetchall()) == 2
 def test_last_repobased_eval_tms_2(self, pg_db_conn):
     """Test select empty repo-based eval timestamp"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         cur.execute("delete from timestamp_kv where name = %s", (constants.TIMESTAMP_LAST_REPO_BASED_EVAL,))
         val = BaseView.get_last_repobased_eval_tms(cur)
         assert val is None
 def test_last_repobased_eval_tms_4(self, pg_db_conn):
     """Test update repo-based eval timestamp"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         val = datetime.datetime(2014, 1, 1, 6, 1, 1, tzinfo=datetime.timezone(datetime.timedelta(hours=2)))
         val_ret, inserted = BaseView.set_last_repobased_eval_tms(cur, val)
         assert not inserted  # updated
         assert val_ret.isoformat() == '2014-01-01T04:01:01+00:00'
 def test_last_repobased_eval_tms_3(self, pg_db_conn):
     """Test update repo-based eval timestamp"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         cur.execute("delete from timestamp_kv where name = %s", (constants.TIMESTAMP_LAST_REPO_BASED_EVAL,))
         val = datetime.datetime(2014, 1, 1, 8, 1, 1, tzinfo=datetime.timezone(datetime.timedelta(hours=2)))
         val_ret, inserted = BaseView.set_last_repobased_eval_tms(cur, val)
         assert inserted
         assert val_ret.isoformat() == '2014-01-01T06:01:01+00:00'
Exemplo n.º 6
0
 def test_last_repobased_eval_tms_1(self, pg_db_conn):
     """Test select repo-based eval timestamp"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         val = BaseView.get_last_repobased_eval_tms(cur)
         assert val is not None
Exemplo n.º 7
0
 def test_select_inv_ids_1(self, pg_db_conn):
     """Test select all inventory_ids"""
     with pg_db_conn:
         cur = pg_db_conn.cursor()
         BaseView.select_all_inventory_ids(cur)
         assert len(cur.fetchall()) == 19