INNER CODE UNIT · Rust
test_build_from_json_google_cloud_storage
splitgraph/seafowl · object_store_factory/src/lib.rs:286
fn test_build_from_json_google_cloud_storage() {
let url = Url::parse("gs://bucket").unwrap();
let json_str = json!({
"type": "gcs",
"bucket": "bucket",
"google_application_credentials": "test_credentials"
})
.to_string();
let config = ObjectStoreConfig::build_from_json(&url, &json_str).unwrap();
if let ObjectStoreConfig::GoogleCloudStorage(gcs_config) = config {
assert_eq!(gcs_config.bucket, "bucket");
assert_eq!(
gcs_config.google_application_credentials.unwrap(),
"test_credentials"
);
} else {
panic!("Expected ObjectStoreConfig::GoogleCloudStorage");