From 2e1f3114cd607f52da9ce4a1edcd9ef378c1995a Mon Sep 17 00:00:00 2001 From: Saugat Pachhai Date: Sat, 30 Nov 2019 19:47:30 +0545 Subject: [PATCH] dvc: write tests --- tests/unit/remote/test_s3.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/unit/remote/test_s3.py b/tests/unit/remote/test_s3.py index 49fc3dbb8..1d188b84c 100644 --- a/tests/unit/remote/test_s3.py +++ b/tests/unit/remote/test_s3.py @@ -13,10 +13,12 @@ def remote(): ├── data │ ├── alice │ ├── alpha + │ ├── subdir-file.txt │ └── subdir │ ├── 1 │ ├── 2 │ └── 3 + ├── data1.txt ├── empty_dir ├── empty_file └── foo @@ -26,6 +28,7 @@ def remote(): s3 = remote.s3 s3.create_bucket(Bucket="bucket") + s3.put_object(Bucket="bucket", Key="data1.txt", Body=b"") s3.put_object(Bucket="bucket", Key="empty_dir/") s3.put_object(Bucket="bucket", Key="empty_file", Body=b"") s3.put_object(Bucket="bucket", Key="foo", Body=b"foo") @@ -34,6 +37,9 @@ def remote(): s3.put_object(Bucket="bucket", Key="data/subdir/1", Body=b"1") s3.put_object(Bucket="bucket", Key="data/subdir/2", Body=b"2") s3.put_object(Bucket="bucket", Key="data/subdir/3", Body=b"3") + s3.put_object( + Bucket="bucket", Key="data/subdir-file.txt", Body=b"subdir" + ) yield remote @@ -66,6 +72,7 @@ def test_exists(remote): (True, "data/subdir/1"), (False, "data/al"), (False, "foo/"), + (True, "data1.txt"), ] for expected, path in test_cases: @@ -76,9 +83,11 @@ def test_walk_files(remote): files = [ remote.path_info / "data/alice", remote.path_info / "data/alpha", + remote.path_info / "data/subdir-file.txt", remote.path_info / "data/subdir/1", remote.path_info / "data/subdir/2", remote.path_info / "data/subdir/3", + remote.path_info / "data1.txt", remote.path_info / "empty_file", remote.path_info / "foo", ]