From ee584533e0a15fae2460d1ea5ac3e7df9462181c Mon Sep 17 00:00:00 2001 From: aschenbecherwespe Date: Thu, 3 Nov 2022 22:09:41 +0100 Subject: [PATCH 1/4] add workaround for lack of error message --- pkg/reduct/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/reduct/client.py b/pkg/reduct/client.py index b5b0664..01a78d2 100644 --- a/pkg/reduct/client.py +++ b/pkg/reduct/client.py @@ -101,7 +101,7 @@ async def get_bucket(self, name: str) -> Bucket: Raises: ReductError: if there is an HTTP error """ - await self._http.request_all("HEAD", f"/b/{name}") + await self._http.request_all("GET", f"/b/{name}") return Bucket(name, self._http) async def create_bucket( From 5754af29af3af0805ee7c8e332beb2aa2bd3d5ed Mon Sep 17 00:00:00 2001 From: aschenbecherwespe Date: Thu, 3 Nov 2022 22:12:45 +0100 Subject: [PATCH 2/4] update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index c911017..ab10394 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [Unreleased] + +### Changed: + +- `client.get_bucket` now uses `GET` instead of `HEAD` in order to be able to return a meaningful error to the user. + ## [v1.0.0] - 2022-10-18 ### Added: From 5429d247e497cd944ec097fe0682246e51802765 Mon Sep 17 00:00:00 2001 From: aschenbecherwespe Date: Fri, 4 Nov 2022 20:16:52 +0100 Subject: [PATCH 3/4] test message to prevent regression --- tests/client_test.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/client_test.py b/tests/client_test.py index bc8e693..b258eca 100644 --- a/tests/client_test.py +++ b/tests/client_test.py @@ -108,8 +108,9 @@ async def test__get_bucket(client): @pytest.mark.asyncio async def test__get_bucket_with_error(client): """Should raise an error, if bucket doesn't exist""" - with pytest.raises(ReductError): + with pytest.raises(ReductError) as reduct_err: await client.get_bucket("NOTEXIST") + assert "Status 404: Bucket 'NOTEXIST' is not found" == str(reduct_err.value) def test__exception_formatting(): From 46492bd344aaa2c5bfaced0a9747acfc5afcb9b6 Mon Sep 17 00:00:00 2001 From: aschenbecherwespe Date: Fri, 4 Nov 2022 20:18:47 +0100 Subject: [PATCH 4/4] fix format --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab10394..bdcc26c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed: -- `client.get_bucket` now uses `GET` instead of `HEAD` in order to be able to return a meaningful error to the user. +- `client.get_bucket` now uses `GET` instead of `HEAD` in order to be able to return a meaningful error to the user, [PR-51](https://github.com/reduct-storage/reduct-py/pull/51) ## [v1.0.0] - 2022-10-18