-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add stat_object method #21
Comments
I implemented it in my forked repo, which I changed quite a lot in the mean time. I do not think you will like to review all the changes at once, I am not even sure you would want to have them. I suggest you look at what I did for stat_object, and cherry pick the code. It is line 257 in https://github.com/cottephi/pytest-minio-mock/blob/master/pytest_minio_mock/plugin.py |
In the end I did what you can see in the code below, so that it simulates an error in the event that the object is not in the bucket: def stat_object_side_effect(bucket_name, object_name): # noqa: ARG001
if object_name == "missing_id":
error_code = "NoSuchKey"
error_message = "The specified key does not exist."
raise S3Error(error_code, error_message, None, None, None, None)
minio_moc.stat_object = Mock(side_effect=stat_object_side_effect) |
Ok I just finished implementing and adding tests for |
published. |
I am using pytest-minio-mock in a project where I need to delete a document but I need to return an error if the document does not exist and for that I use the "stat_object" function. Could this function be added? or how could I do the test?
The text was updated successfully, but these errors were encountered: