forked from linode/linode_api4-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_obj_quotas.py
More file actions
58 lines (45 loc) · 1.92 KB
/
test_obj_quotas.py
File metadata and controls
58 lines (45 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
from linode_api4.objects.object_storage import (
ObjectStorageQuota,
ObjectStorageQuotaUsage,
)
def test_list_obj_storage_quotas(test_linode_client):
quotas = test_linode_client.object_storage.quotas()
target_quota_id = "obj-buckets-us-sea-1.linodeobjects.com"
found_quota = None
for quota in quotas:
if quota.quota_id == target_quota_id:
found_quota = quota
break
assert (
found_quota is not None
), f"Quota with ID {target_quota_id} not found."
assert found_quota.quota_id == "obj-buckets-us-sea-1.linodeobjects.com"
assert found_quota.quota_name == "max_buckets"
assert found_quota.endpoint_type == "E1"
assert found_quota.s3_endpoint == "us-sea-1.linodeobjects.com"
assert (
found_quota.description
== "Maximum number of buckets this customer is allowed to have on this endpoint"
)
assert found_quota.quota_limit == 1000
assert found_quota.resource_metric == "bucket"
def test_get_obj_storage_quota(test_linode_client):
quota_id = "obj-objects-us-ord-1.linodeobjects.com"
quota = test_linode_client.load(ObjectStorageQuota, quota_id)
assert quota.quota_id == "obj-objects-us-ord-1.linodeobjects.com"
assert quota.quota_name == "max_objects"
assert quota.endpoint_type == "E1"
assert quota.s3_endpoint == "us-ord-1.linodeobjects.com"
assert (
quota.description
== "Maximum number of objects this customer is allowed to have on this endpoint"
)
assert quota.quota_limit == 100000000
assert quota.resource_metric == "object"
def test_get_obj_storage_quota_usage(test_linode_client):
quota_id = "obj-objects-us-ord-1.linodeobjects.com"
quota = test_linode_client.load(ObjectStorageQuota, quota_id)
quota_usage = quota.usage()
assert isinstance(quota_usage, ObjectStorageQuotaUsage)
assert quota_usage.quota_limit == 100000000
assert quota_usage.usage >= 0