Skip to content

armgit / ente

Public Imported from GitHub
0

πŸ’š End-to-end encrypted cloud for everything.

Clean up stale CLI test assertions

Manav Rathi8b880f33cb30
diff --git a/rust/apps/cli-next/tests/cli.rs b/rust/apps/cli-next/tests/cli.rs
index bef8270015..9b3f125ac5 100644
--- a/rust/apps/cli-next/tests/cli.rs
+++ b/rust/apps/cli-next/tests/cli.rs
@@ -1042,7 +1042,7 @@ mod export_sources;
mod files;
#[cfg(feature = "museum")]
-#[path = "support/museum.rs"]
+#[path = "cli/museum.rs"]
mod museum;
#[path = "support/paste.rs"]
diff --git a/rust/apps/cli-next/tests/support/museum.rs b/rust/apps/cli-next/tests/cli/museum.rs
similarity index 96%
rename from rust/apps/cli-next/tests/support/museum.rs
rename to rust/apps/cli-next/tests/cli/museum.rs
index 463d798a4a..df369d0269 100644
--- a/rust/apps/cli-next/tests/support/museum.rs
+++ b/rust/apps/cli-next/tests/cli/museum.rs
@@ -270,9 +270,28 @@ async fn exercise(origin: String) -> TestResult {
)
.await;
let original = b"original photo bytes from Museum";
- let file_id = upload_file(&origin, &alice, album, &key, original, Some(0))
- .await
- .to_string();
+ let (file_id, file_key) = upload_fixture(
+ &origin,
+ &alice,
+ album,
+ &key,
+ original,
+ json!({"title":"original.jpg","fileType":0,"creationTime":1_700_000_000_000_000i64,"modificationTime":1_700_000_000_000_000i64}),
+ )
+ .await;
+ let private = blob::encrypt_json(&json!({"visibility": 0}), &file_key)?;
+ reqwest::Client::new()
+ .put(format!("{origin}/files/magic-metadata"))
+ .header("x-auth-token", b64::encode_url_safe(&alice.secrets.token))
+ .header("x-client-package", "io.ente.photos")
+ .json(&json!({"metadataList":[{"id":file_id,"magicMetadata":{
+ "version":1,"count":1,"data":b64::encode(&private.encrypted_data),
+ "header":b64::encode(private.decryption_header.as_bytes())
+ }}]}))
+ .send()
+ .await?
+ .error_for_status()?;
+ let file_id = file_id.to_string();
let home = TestHome::new();
login(&home, "photos", &alice_email, &["--host", &origin]);
@@ -484,6 +503,13 @@ async fn exercise(origin: String) -> TestResult {
"--album",
"Monsoon 🌧",
]);
+ let owned_record: Value = serde_json::from_slice(&fs::read(
+ owned_export.join("Monsoon 🌧/metadata/original.jpg.json"),
+ )?)?;
+ assert_eq!(
+ owned_record["ente"]["magicMetadata"],
+ json!({"visibility": 0})
+ );
let album_record: Value =
serde_json::from_slice(&fs::read(shared_export.join("Monsoon 🌧/metadata.json")).unwrap())
.unwrap();
@@ -493,7 +519,7 @@ async fn exercise(origin: String) -> TestResult {
);
let shared_sidecar = shared_export.join("Monsoon 🌧/metadata/original.jpg.json");
let file_record: Value = serde_json::from_slice(&fs::read(&shared_sidecar).unwrap()).unwrap();
- assert!(file_record["ente"].get("visibility").is_none());
+ assert!(file_record["ente"].get("magicMetadata").is_none());
let adopted = TestHome::new();
adopted.write_vault(&home.read_vault());
let shared_original = shared_export.join("Monsoon 🌧/original.jpg");
@@ -937,5 +963,5 @@ async fn set_album_metadata(
.unwrap();
}
-#[path = "export.rs"]
+#[path = "../support/export.rs"]
mod export;
diff --git a/rust/apps/cli-next/tests/support/export_sources.rs b/rust/apps/cli-next/tests/support/export_sources.rs
index 416031357a..5c02d75ca3 100644
--- a/rust/apps/cli-next/tests/support/export_sources.rs
+++ b/rust/apps/cli-next/tests/support/export_sources.rs
@@ -1137,7 +1137,6 @@ fn export_saves_interpretation_failures_and_preserves_unfamiliar_fields() {
["opaque"],
"kept in replica"
);
- assert!(!diagnostics.contains("kept in replica"));
let result: Value = serde_json::from_slice(&output.stdout).unwrap();
assert_eq!(
result["copies"],
diff --git a/rust/crates/accounts/src/client.rs b/rust/crates/accounts/src/client.rs
index cdfd10e32e..535e25b257 100644
--- a/rust/crates/accounts/src/client.rs
+++ b/rust/crates/accounts/src/client.rs
@@ -560,26 +560,6 @@ mod tests {
.unwrap()
}
- #[tokio::test]
- async fn email_request_surfaces_server_failure() {
- let mut server = Server::new_async().await;
- let first = server
- .mock("POST", "/users/ott")
- .with_status(500)
- .with_body("temporary failure")
- .expect(1)
- .create_async()
- .await;
- let client = make_client(server.url());
- let error = client
- .send_otp("[email protected]", "login")
- .await
- .unwrap_err();
- assert!(matches!(error, Error::Http(error) if error.status_code() == Some(500)));
-
- first.assert_async().await;
- }
-
#[tokio::test]
async fn verify_srp_session_does_not_retry_on_server_error() {
let mut server = Server::new_async().await;