def test_retrieve_nonexistent(self, rec_id, res_id, config_file_path, results_file_path, schema_file_path, backend): args = dict(schema_path=schema_file_path, name="test") backend_data = {"database_config": config_file_path} if backend == "db"\ else {"results_file": results_file_path} args.update(backend_data) psm = PipestatManager(**args) with pytest.raises(PipestatDatabaseError): psm.retrieve(result_identifier=res_id, record_identifier=rec_id)
def test_retrieve_whole_record(self, rec_id, config_file_path, results_file_path, schema_file_path, backend): args = dict(schema_path=schema_file_path, name="test") backend_data = {"database_config": config_file_path} if backend == "db"\ else {"results_file": results_file_path} args.update(backend_data) psm = PipestatManager(**args) assert isinstance(psm.retrieve(record_identifier=rec_id), Mapping)
def test_retrieve_basic(self, rec_id, res_id, val, config_file_path, results_file_path, schema_file_path, backend): args = dict(schema_path=schema_file_path, name="test") backend_data = {"database_config": config_file_path} if backend == "db"\ else {"results_file": results_file_path} args.update(backend_data) psm = PipestatManager(**args) retrieved_val = psm.retrieve(result_identifier=res_id, record_identifier=rec_id) assert str(retrieved_val) == str(val)
def test_retrieve(self, val, config_file_path, schema_file_path, results_file_path, backend): REC_ID = "constant_record_id" args = dict(schema_path=schema_file_path, namespace="test", record_identifier=REC_ID) backend_data = ({ "config": config_file_path } if backend == "db" else { "results_file_path": results_file_path }) args.update(backend_data) psm = PipestatManager(**args) retrieved_val = psm.retrieve(result_identifier=list(val.keys())[0]) assert str(retrieved_val) == str(list(val.values())[0])