Skip to content

Commit

Permalink
fixed unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
krokicki committed Aug 19, 2024
1 parent 6b5bedf commit 74151da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions tests/test_serve.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ def test_list_objects():
root = parse_xml(response.text)
assert root.tag == "ListBucketResult"
assert root.find('Name').text == bucket_name
assert len(root.findall('CommonPrefixes')) == 1

# CommonPrefixes are only returned when there is a delimiter
assert len(root.findall('CommonPrefixes')) == 0

contents = root.findall('Contents')
assert len(contents) <= max_keys
Expand All @@ -99,7 +101,7 @@ def test_list_objects_delimiter():
assert root.find('Delimiter').text == '/'
assert len(root.findall('CommonPrefixes')) == 1
assert root.find('IsTruncated').text == "false"


def test_list_objects_continuation():
with TestClient(app) as client:
Expand All @@ -120,7 +122,7 @@ def test_list_objects_continuation():
assert root.tag == "ListBucketResult"
assert root.find('Name').text == bucket_name
assert root.find('MaxKeys').text == str(max_keys)
assert len(root.findall('CommonPrefixes')) == 1
assert len(root.findall('CommonPrefixes')) == 0

contents = root.findall('Contents')
print(f"Got {len(contents)} results")
Expand Down Expand Up @@ -195,7 +197,7 @@ def test_prefixed_list_objects():
assert root.tag == "ListBucketResult"
assert root.find('Name').text == bucket_name
assert root.find('Delimiter').text == '/'
assert len(root.findall('CommonPrefixes')) == 1
assert len(root.findall('CommonPrefixes')) == 2
assert root.find('IsTruncated').text == "false"


Expand Down

0 comments on commit 74151da

Please sign in to comment.