mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-25 05:29:39 +00:00
tests: set user and email in e2e tests
We don't display the user and email yet, so the only visible effect this has on the tests is that some hashes change.
This commit is contained in:
parent
9702684a4d
commit
a9eebe779e
4 changed files with 16 additions and 8 deletions
|
@ -79,8 +79,14 @@ impl UserSettings {
|
|||
}
|
||||
|
||||
let mut env_config = config::Config::new();
|
||||
if let Ok(timestamp_str) = env::var("JJ_TIMESTAMP") {
|
||||
env_config.set("user.timestamp", timestamp_str)?;
|
||||
if let Ok(value) = env::var("JJ_USER") {
|
||||
env_config.set("user.name", value)?;
|
||||
}
|
||||
if let Ok(value) = env::var("JJ_EMAIL") {
|
||||
env_config.set("user.email", value)?;
|
||||
}
|
||||
if let Ok(value) = env::var("JJ_TIMESTAMP") {
|
||||
env_config.set("user.timestamp", value)?;
|
||||
}
|
||||
config.merge(env_config)?;
|
||||
|
||||
|
|
|
@ -52,6 +52,8 @@ impl TestEnvironment {
|
|||
*command_number += 1;
|
||||
let timestamp = timestamp + chrono::Duration::seconds(*command_number);
|
||||
cmd.env("JJ_TIMESTAMP", timestamp.to_rfc3339());
|
||||
cmd.env("JJ_USER", "Test User");
|
||||
cmd.env("JJ_EMAIL", "test.user@example.com");
|
||||
cmd
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ fn smoke_test() {
|
|||
let assert = test_env.jj_cmd(&repo_path, &["status"]).assert().success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
|
||||
Parent commit: 000000000000
|
||||
Working copy : 1d1984a23811
|
||||
Working copy : 230dd059e1b0
|
||||
The working copy is clean
|
||||
"###);
|
||||
|
||||
|
@ -41,7 +41,7 @@ fn smoke_test() {
|
|||
let stdout_string = get_stdout_string(&assert);
|
||||
insta::assert_snapshot!(stdout_string, @r###"
|
||||
Parent commit: 000000000000
|
||||
Working copy : 5e60c5091e43
|
||||
Working copy : d38745675403
|
||||
Working copy changes:
|
||||
A file1
|
||||
A file2
|
||||
|
@ -60,11 +60,11 @@ fn smoke_test() {
|
|||
.jj_cmd(&repo_path, &["describe", "-m", "add some files"])
|
||||
.assert()
|
||||
.success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 6f13b3e41065 add some files
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 701b3d5a2eb3 add some files
|
||||
");
|
||||
|
||||
// Close the commit
|
||||
let assert = test_env.jj_cmd(&repo_path, &["close"]).assert().success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: 6ff8a22d8ce1
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @"Working copy now at: a13f828fab1a
|
||||
");
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@ fn test_no_commit_working_copy() {
|
|||
.success();
|
||||
let stdout_string = get_stdout_string(&assert);
|
||||
insta::assert_snapshot!(stdout_string, @r###"
|
||||
@ 1e9ff0ea7220c37a1d2c4aab153e238c12ff3cd0
|
||||
@ 438471f3fbf1004298d8fb01eeb13663a051a643
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
|
||||
|
@ -53,7 +53,7 @@ fn test_no_commit_working_copy() {
|
|||
.assert()
|
||||
.success();
|
||||
insta::assert_snapshot!(get_stdout_string(&assert), @r###"
|
||||
@ cc12440b719c67fcd8c55848eb345f67b6e2d9f1
|
||||
@ fab22d1acf5bb9c5aa48cb2c3dd2132072a359ca
|
||||
o 0000000000000000000000000000000000000000
|
||||
"###);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue