Exemple #1
0
    def test_split_s3_path(self):
        # Test splitting good urls.
        assert split_s3_path("s3://my-bucket/subdir/file.txt") == ("my-bucket", "subdir/file.txt")
        assert split_s3_path("s3://my-bucket/file.txt") == ("my-bucket", "file.txt")

        # Test splitting bad urls.
        with pytest.raises(ValueError):
            split_s3_path("s3://")
            split_s3_path("s3://myfile.txt")
            split_s3_path("myfile.txt")
Exemple #2
0
    def test_split_s3_path(self):
        # Test splitting good urls.
        assert split_s3_path("s3://my-bucket/subdir/file.txt") == ("my-bucket", "subdir/file.txt")
        assert split_s3_path("s3://my-bucket/file.txt") == ("my-bucket", "file.txt")

        # Test splitting bad urls.
        with pytest.raises(ValueError):
            split_s3_path("s3://")
            split_s3_path("s3://myfile.txt")
            split_s3_path("myfile.txt")
Exemple #3
0
 def get_file_info(url):
     bucket_name, s3_path = split_s3_path(url)
     return s3_resource.Object(bucket_name, s3_path).content_type
Exemple #4
0
 def get_file_info(url):
     bucket_name, s3_path = split_s3_path(url)
     return s3_resource.Object(bucket_name, s3_path).content_type