mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-04 17:38:10 +00:00
test improvements
This commit is contained in:
1 parent
d1b9331df1
commit
298e7df459
5 files changed
+56
-7
No files matched your search
@@ -109,7 +109,7 @@ mod tests {
|
||||
let creds = get_test_api_key().unwrap();
|
||||
|
||||
// Use a known operation_id from a previous generate_world call
|
||||
let operation_id = OperationId("REPLACE_WITH_REAL_ID".to_string());
|
||||
let operation_id = OperationId("1fab3bf1-05a1-4929-907e-c6df07c539e2".to_string());
|
||||
|
||||
let response = get_operation(GetOperationArgs {
|
||||
creds: &creds,
|
||||
|
||||
@@ -22,7 +22,10 @@ pub struct GetWorldResponse {
|
||||
pub created_at: Option<String>,
|
||||
pub updated_at: Option<String>,
|
||||
pub model: Option<String>,
|
||||
/// e.g. "SUCCEEDED", "PENDING", "FAILED", "RUNNING"
|
||||
pub status: Option<String>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
pub is_public: Option<bool>,
|
||||
pub assets: Option<WorldAssets>,
|
||||
}
|
||||
|
||||
@@ -100,7 +103,9 @@ pub async fn get_world(args: GetWorldArgs<'_>) -> Result<GetWorldResponse, World
|
||||
created_at: raw.created_at,
|
||||
updated_at: raw.updated_at,
|
||||
model: raw.model,
|
||||
status: raw.status,
|
||||
tags: raw.tags,
|
||||
is_public: raw.permission.and_then(|p| p.public),
|
||||
assets,
|
||||
})
|
||||
}
|
||||
@@ -132,11 +137,24 @@ mod tests {
|
||||
println!("World ID: {}", response.world_id);
|
||||
println!("Display name: {:?}", response.display_name);
|
||||
println!("Marble URL: {:?}", response.world_marble_url);
|
||||
println!("Created at: {:?}", response.created_at);
|
||||
println!("Updated at: {:?}", response.updated_at);
|
||||
println!("Model: {:?}", response.model);
|
||||
if let Some(assets) = &response.assets {
|
||||
println!("Caption: {:?}", assets.caption);
|
||||
println!("Thumbnail: {:?}", assets.thumbnail_url);
|
||||
println!("SPZ full res: {:?}", assets.spz_url_full_res);
|
||||
println!("Status: {:?}", response.status);
|
||||
println!("Tags: {:?}", response.tags);
|
||||
println!("Is public: {:?}", response.is_public);
|
||||
match &response.assets {
|
||||
None => println!("Assets: None"),
|
||||
Some(assets) => {
|
||||
println!("Assets:");
|
||||
println!(" Caption: {:?}", assets.caption);
|
||||
println!(" Thumbnail URL: {:?}", assets.thumbnail_url);
|
||||
println!(" Pano URL: {:?}", assets.pano_url);
|
||||
println!(" Collider mesh URL: {:?}", assets.collider_mesh_url);
|
||||
println!(" SPZ 100k: {:?}", assets.spz_url_100k);
|
||||
println!(" SPZ 500k: {:?}", assets.spz_url_500k);
|
||||
println!(" SPZ full res: {:?}", assets.spz_url_full_res);
|
||||
}
|
||||
}
|
||||
|
||||
assert_eq!(1, 2);
|
||||
|
||||
@@ -8,10 +8,19 @@ pub(crate) struct RawResponse {
|
||||
pub created_at: Option<String>,
|
||||
pub updated_at: Option<String>,
|
||||
pub model: Option<String>,
|
||||
pub status: Option<String>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
pub permission: Option<RawPermission>,
|
||||
pub assets: Option<RawWorldAssets>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct RawPermission {
|
||||
pub public: Option<bool>,
|
||||
pub allow_id_access: Option<bool>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
pub(crate) struct RawWorldAssets {
|
||||
pub caption: Option<String>,
|
||||
@@ -32,8 +41,17 @@ pub(crate) struct RawMesh {
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct RawSplats {
|
||||
pub spz_urls: Option<RawSpzUrls>,
|
||||
pub semantics_metadata: Option<RawSemanticsMetadata>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[allow(dead_code)]
|
||||
pub(crate) struct RawSemanticsMetadata {
|
||||
pub metric_scale_factor: Option<f64>,
|
||||
pub ground_plane_offset: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
||||
@@ -36,5 +36,6 @@ pub(crate) struct RawWorldSummary {
|
||||
pub created_at: Option<String>,
|
||||
pub updated_at: Option<String>,
|
||||
pub model: Option<String>,
|
||||
pub status: Option<String>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
@@ -42,6 +42,8 @@ pub struct WorldSummary {
|
||||
pub created_at: Option<String>,
|
||||
pub updated_at: Option<String>,
|
||||
pub model: Option<String>,
|
||||
/// e.g. "SUCCEEDED", "PENDING", "FAILED", "RUNNING"
|
||||
pub status: Option<String>,
|
||||
pub tags: Option<Vec<String>>,
|
||||
}
|
||||
|
||||
@@ -108,6 +110,7 @@ pub async fn list_worlds(args: ListWorldsArgs<'_>) -> Result<ListWorldsResponse,
|
||||
created_at: w.created_at,
|
||||
updated_at: w.updated_at,
|
||||
model: w.model,
|
||||
status: w.status,
|
||||
tags: w.tags,
|
||||
}).collect();
|
||||
|
||||
@@ -147,9 +150,18 @@ mod tests {
|
||||
|
||||
println!("Worlds count: {}", response.worlds.len());
|
||||
println!("Next page token: {:?}", response.next_page_token);
|
||||
println!();
|
||||
|
||||
for world in &response.worlds {
|
||||
println!(" World ID: {} | Name: {:?} | Model: {:?}", world.world_id, world.display_name, world.model);
|
||||
for (i, world) in response.worlds.iter().enumerate() {
|
||||
println!("--- World {} ---", i + 1);
|
||||
println!(" World ID: {}", world.world_id);
|
||||
println!(" Display name: {:?}", world.display_name);
|
||||
println!(" Marble URL: {:?}", world.world_marble_url);
|
||||
println!(" Created at: {:?}", world.created_at);
|
||||
println!(" Updated at: {:?}", world.updated_at);
|
||||
println!(" Model: {:?}", world.model);
|
||||
println!(" Status: {:?}", world.status);
|
||||
println!(" Tags: {:?}", world.tags);
|
||||
}
|
||||
|
||||
assert_eq!(1, 2);
|
||||
|
||||
Reference in new issue
Block a user