def test_get_dataproduct_not_exist(dataspace): # noqa: F811 """Does it error out if we ask for bogus information?""" with pytest.raises((KeyError, NoResultFound)): dataspace.get_dataproduct( taskmanager_id=2, generation_id=2, key="no_such_key", )
def test_get_dataproduct(dataspace): # noqa: F811 """Can we get the dataproduct by uuid with key""" result2 = dataspace.get_dataproduct( taskmanager_id=2, generation_id=2, key="other_test_key", ) assert result2 == b"other_test_value"
def test_update(dataspace): # noqa: F811 """Do updates work as expected""" metadata_row = dataspace.get_metadata( taskmanager_id=1, generation_id=1, key="my_test_key", ) header_row = dataspace.get_header( taskmanager_id=1, generation_id=1, key="my_test_key", ) dataspace.update( taskmanager_id=1, generation_id=1, key="my_test_key", value=b"I changed IT", header=Header( header_row[0], create_time=header_row[4], expiration_time=header_row[5], scheduled_create_time=header_row[6], creator=header_row[7], schema_id=header_row[8], ), metadata=Metadata( metadata_row[0], state=metadata_row[4], generation_id=metadata_row[2], generation_time=metadata_row[5], missed_update_count=metadata_row[6], ), ) result1 = dataspace.get_dataproduct( taskmanager_id=1, generation_id=1, key="my_test_key", ) assert result1 == b"I changed IT"