Skip to main content

Add some tests for parse_s3_uri

ID
4690404
date
2024-06-13 10:16:24+00:00
author
Alex Chan <alex@alexwlchan.net>
parent
8438e77
message
Add some tests for `parse_s3_uri`
changed files
1 file, 15 additions

Changed files

aws/test_common.py (0) → aws/test_common.py (384)

diff --git a/aws/test_common.py b/aws/test_common.py
new file mode 100644
index 0000000..db2e93e
--- /dev/null
+++ b/aws/test_common.py
@@ -0,0 +1,15 @@
+import pytest
+
+from _common import parse_s3_uri
+
+
+def test_non_s3_uri_is_error():
+    with pytest.raises(ValueError, match="Unrecognised scheme"):
+        parse_s3_uri(s3_uri="https://www.example.com")
+
+
+def test_parses_s3_uri():
+    assert parse_s3_uri(s3_uri="s3://example-bukkit/my/text/file.txt") == {
+        "Bucket": "example-bukkit",
+        "Path": "my/text/file.txt",
+    }