Skip to content

Commit daab10f

Browse files
committed
Fix test
1 parent c467c3e commit daab10f

File tree

1 file changed

+6
-18
lines changed

1 file changed

+6
-18
lines changed

test/integration/models/object_storage/test_obj_quotas.py

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,10 @@ def test_get_obj_storage_quota_usage(test_linode_client):
4545
quota_id = quotas[0].quota_id
4646
quota = test_linode_client.load(ObjectStorageQuota, quota_id)
4747

48-
with pytest.raises(ApiError) as exc:
48+
# quota without usage should return an API error on usage retrieval
49+
with pytest.raises(ApiError):
4950
quota.usage()
5051

51-
assert exc.value.status == 404
52-
assert "Usage not supported" in str(exc.value)
5352
return
5453

5554
quota_id = quota_with_usage.quota_id
@@ -65,12 +64,7 @@ def test_get_obj_storage_quota_usage(test_linode_client):
6564

6665

6766
def test_list_and_get_obj_storage_global_quotas(test_linode_client):
68-
try:
69-
quotas = test_linode_client.object_storage.global_quotas()
70-
except ApiError as err:
71-
if err.status == 404:
72-
pytest.skip("Object Storage is not enabled on this account.")
73-
raise
67+
quotas = test_linode_client.object_storage.global_quotas()
7468

7569
if len(quotas) < 1:
7670
pytest.skip("No available global quota for testing. Skipping now...")
@@ -91,12 +85,7 @@ def test_list_and_get_obj_storage_global_quotas(test_linode_client):
9185

9286

9387
def test_get_obj_storage_global_quota_usage(test_linode_client):
94-
try:
95-
quotas = test_linode_client.object_storage.global_quotas()
96-
except ApiError as err:
97-
if err.status == 404:
98-
pytest.skip("Object Storage is not enabled on this account.")
99-
raise
88+
quotas = test_linode_client.object_storage.global_quotas()
10089

10190
if len(quotas) < 1:
10291
pytest.skip("No available global quota for testing. Skipping now...")
@@ -109,11 +98,10 @@ def test_get_obj_storage_global_quota_usage(test_linode_client):
10998
quota_id = quotas[0].quota_id
11099
quota = test_linode_client.load(ObjectStorageGlobalQuota, quota_id)
111100

112-
with pytest.raises(ApiError) as exc:
101+
# quota without usage should return an API error on usage retrieval
102+
with pytest.raises(ApiError):
113103
quota.usage()
114104

115-
assert exc.value.status == 404
116-
assert "Usage not supported" in str(exc.value)
117105
return
118106

119107
quota_id = quota_with_usage.quota_id

0 commit comments

Comments
 (0)