Пример #1
0
def test_s3_file_system_eq(other_fs_params, result):
    """Should compare S3FileSystems."""
    fs = s3.S3FileSystem("name1", "KEY_ID_1", "SECRET_KEY_1", "BUCKET",
                         "https://s3.example.com")
    other_fs = s3.S3FileSystem(*other_fs_params[:5],
                               **next(iter(other_fs_params[5:]), dict()))

    assert (fs == other_fs) == result
Пример #2
0
def test_s3_file_system_init():
    """Should parse args on init and pass expected values to S3fs's S3FileSystem."""
    fs = s3.S3FileSystem("source_x", "KEY_ID", "SECRET_KEY", "BUCKET", formatter="FORMATTER", unpack=True)

    assert fs.is_source
    assert fs.formatter == "FORMATTER"
    assert fs.flags == dict(unpack=True)
    assert fs.s3fs.client_kwargs == dict(endpoint_url=s3.DEFAULT_ENDPOINTS["source"])
    assert fs.s3fs.key == "KEY_ID"
    assert fs.s3fs.secret == "SECRET_KEY"
Пример #3
0
def test_s3_file_system_str():
    """Name is the string repr of S3FileSystem."""
    fs = s3.S3FileSystem("name1", "KEY_ID_1", "SECRET_KEY_1", "BUCKET", "https://s3.example.com")
    assert str(fs) == "name1"
Пример #4
0
def test_s3_file_system_eq_to_different_type():
    """Should not compare to other types."""
    fs = s3.S3FileSystem("name1", "KEY_ID_1", "SECRET_KEY_1", "BUCKET", "https://s3.example.com")

    assert (fs == "a") is False
Пример #5
0
def test_s3_file_system_endpoints(name, default_endpoints_key, endpoint_url):
    """Should select default endpoint url if not specified, leave untouched if specified."""
    fs = s3.S3FileSystem(name, "KEY_ID", "SECRET_KEY", "BUCKET", endpoint_url)
    assert fs.endpoint_url == s3.DEFAULT_ENDPOINTS.get(default_endpoints_key, endpoint_url)