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 = [] ServerApplication.select_repo_based_inventory_ids(cur, repos) assert list(cur.fetchall()) == []
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"] ServerApplication.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 = ServerApplication.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 = ServerApplication.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 = ServerApplication.set_last_repobased_eval_tms(cur, val) assert inserted assert val_ret.isoformat() == '2014-01-01T06:01:01+00:00'
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 = ServerApplication.get_last_repobased_eval_tms(cur) assert val is not None
def test_select_inv_ids_1(self, pg_db_conn): """Test select all inventory_ids""" with pg_db_conn: cur = pg_db_conn.cursor() ServerApplication.select_all_inventory_ids(cur) assert len(cur.fetchall()) == 12