Skip to content

armgit / ente

Public Imported from GitHub
0

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

Move the paste origin into the CLI test

Manav Rathife3b6f41dd6a
diff --git a/rust/apps/cli/tests/paste.rs b/rust/apps/cli/tests/paste.rs
index 3fa8023d86..ba4576e431 100644
--- a/rust/apps/cli/tests/paste.rs
+++ b/rust/apps/cli/tests/paste.rs
@@ -5,6 +5,7 @@ use support::{Cli, Museum, TestResult};
use uuid::Uuid;
const PASTE_PASSWORD_ENV: &str = "ENTE_PASTE_PASSWORD";
+const PASTE_ORIGIN: &str = "http://127.0.0.1";
#[test]
fn paste() -> TestResult {
@@ -85,11 +86,11 @@ fn stdin_roundtrip(museum: &Museum) -> TestResult {
"--endpoint",
museum.endpoint(),
"--paste-origin",
- museum.paste_origin(),
+ PASTE_ORIGIN,
],
&text,
)?;
- let link = PasteLink::parse(link.trim(), museum.paste_origin());
+ let link = PasteLink::parse(link.trim(), PASTE_ORIGIN);
let consumed = cli.run_ok(&[
"paste",
@@ -233,10 +234,10 @@ fn create_paste(cli: &Cli, museum: &Museum, text: &str) -> TestResult<PasteLink>
"--endpoint",
museum.endpoint(),
"--paste-origin",
- museum.paste_origin(),
+ PASTE_ORIGIN,
text,
])?;
- Ok(PasteLink::parse(link.trim(), museum.paste_origin()))
+ Ok(PasteLink::parse(link.trim(), PASTE_ORIGIN))
}
fn create_password_paste(
@@ -253,13 +254,13 @@ fn create_password_paste(
"--endpoint",
museum.endpoint(),
"--paste-origin",
- museum.paste_origin(),
+ PASTE_ORIGIN,
"--password",
text,
],
&env,
)?;
- Ok(PasteLink::parse(link.trim(), museum.paste_origin()))
+ Ok(PasteLink::parse(link.trim(), PASTE_ORIGIN))
}
fn unique_text(scope: &str) -> String {
diff --git a/rust/crates/test-support/src/museum.rs b/rust/crates/test-support/src/museum.rs
index f135daddc5..ec54fbac17 100644
--- a/rust/crates/test-support/src/museum.rs
+++ b/rust/crates/test-support/src/museum.rs
@@ -23,7 +23,6 @@ pub struct Museum {
_postgres: postgres::Postgres,
temp_dir: TempDir,
endpoint: String,
- paste_origin: String,
}
impl Museum {
@@ -51,7 +50,6 @@ impl Museum {
let mut temp_dir = TempDir::new("ente-test")?;
let log_dir = temp_dir.path().join("logs");
let museum_port = free_port()?;
- let paste_origin = format!("http://{LOCAL_HOST}");
let endpoint = format!("http://{LOCAL_HOST}:{museum_port}");
let museum_config_file = temp_dir.path().join("museum.yaml");
let museum_bin = temp_dir.path().join("museum");
@@ -64,7 +62,6 @@ impl Museum {
&log_dir,
&museum_config_file,
museum_port,
- &paste_origin,
&museum_bin,
&postgres,
)?;
@@ -84,7 +81,6 @@ impl Museum {
_postgres: postgres,
temp_dir,
endpoint,
- paste_origin,
})
}
@@ -93,11 +89,6 @@ impl Museum {
&self.endpoint
}
- /// The origin Museum uses when generating public paste links.
- pub fn paste_origin(&self) -> &str {
- &self.paste_origin
- }
-
/// A scratch directory tied to this Museum's lifetime, for test-local files.
pub fn temp_dir(&self) -> &Path {
self.temp_dir.path()
diff --git a/rust/crates/test-support/src/server.rs b/rust/crates/test-support/src/server.rs
index 30ef79739e..0fdea3e79e 100644
--- a/rust/crates/test-support/src/server.rs
+++ b/rust/crates/test-support/src/server.rs
@@ -17,7 +17,6 @@ pub fn start(
log_dir: &Path,
config_file: &Path,
museum_port: u16,
- paste_origin: &str,
museum_bin: &Path,
db: &Postgres,
) -> TestResult<ChildProcess> {
@@ -43,7 +42,6 @@ pub fn start(
"ENTE_INTERNAL_HARDCODED_OTT_LOCAL_DOMAIN_VALUE",
HARDCODED_OTT,
)
- .env("ENTE_APPS_PUBLIC_PASTE", paste_origin)
.env("ENTE_JOBS_CRON_SKIP", "true");
let mut museum = ChildProcess::spawn("museum", &mut command, log_dir)?;