Skip to content

Commit 631094f

Browse files
authored
tests: Decode emails before snapshotting them in emails_snapshot() fn (#11296)
This ensures that the regex redactions also work across encoding linebreaks...
1 parent b6aa954 commit 631094f

File tree

23 files changed

+72
-146
lines changed

23 files changed

+72
-146
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ diesel = { version = "=2.2.10", features = ["r2d2"] }
151151
googletest = "=0.14.1"
152152
insta = { version = "=1.43.1", features = ["glob", "json", "redactions"] }
153153
jsonwebtoken = "=9.3.1"
154+
quoted_printable = "=0.5.1"
154155
regex = "=1.11.1"
155156
sentry = { version = "=0.38.1", features = ["test"] }
156157
tokio = "=1.45.1"

src/controllers/krate/snapshots/crates_io__controllers__krate__delete__tests__happy_path_new_crate-2.snap

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new version of the package foo (1.0.0) was published by your account (htt=
14-
ps://crates.io/users/foo) at [0000-00-00T00:00:00Z].
13+
A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
1514

16-
If you have questions or security concerns, you can contact us at help@crat=
17-
es.io. If you would like to stop receiving these security notifications, yo=
18-
u can disable them in your account settings.
15+
If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings.
1916
----------------------------------------
2017

2118
To: foo@example.com
@@ -28,5 +25,4 @@ Hi foo,
2825

2926
Your "foo" crate has been deleted, per your request.
3027

31-
If you did not initiate this deletion, your account may have been compromis=
32-
ed. Please contact us at help@crates.io.
28+
If you did not initiate this deletion, your account may have been compromised. Please contact us at help@crates.io.

src/controllers/krate/snapshots/crates_io__controllers__krate__delete__tests__happy_path_old_crate-2.snap

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new version of the package foo (1.0.0) was published by your account (htt=
14-
ps://crates.io/users/foo) at [0000-00-00T00:00:00Z].
13+
A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
1514

16-
If you have questions or security concerns, you can contact us at help@crat=
17-
es.io. If you would like to stop receiving these security notifications, yo=
18-
u can disable them in your account settings.
15+
If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings.
1916
----------------------------------------
2017

2118
To: foo@example.com
@@ -28,5 +25,4 @@ Hi foo,
2825

2926
Your "foo" crate has been deleted, per your request.
3027

31-
If you did not initiate this deletion, your account may have been compromis=
32-
ed. Please contact us at help@crates.io.
28+
If you did not initiate this deletion, your account may have been compromised. Please contact us at help@crates.io.

src/controllers/krate/snapshots/crates_io__controllers__krate__delete__tests__happy_path_really_old_crate-2.snap

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,9 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new version of the package foo (1.0.0) was published by your account (htt=
14-
ps://crates.io/users/foo) at [0000-00-00T00:00:00Z].
13+
A new version of the package foo (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
1514

16-
If you have questions or security concerns, you can contact us at help@crat=
17-
es.io. If you would like to stop receiving these security notifications, yo=
18-
u can disable them in your account settings.
15+
If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings.
1916
----------------------------------------
2017

2118
To: foo@example.com
@@ -28,5 +25,4 @@ Hi foo,
2825

2926
Your "foo" crate has been deleted, per your request.
3027

31-
If you did not initiate this deletion, your account may have been compromis=
32-
ed. Please contact us at help@crates.io.
28+
If you did not initiate this deletion, your account may have been compromised. Please contact us at help@crates.io.

src/controllers/trustpub/github_configs/create/snapshots/crates_io__controllers__trustpub__github_configs__create__tests__happy_path-2.snap

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
crates.io user foo has added a new "Trusted Publishing" configuration for G=
14-
itHub Actions to a crate that you manage (foo). Trusted publishers act as t=
15-
rusted users and can publish new versions of the crate automatically.
13+
crates.io user foo has added a new "Trusted Publishing" configuration for GitHub Actions to a crate that you manage (foo). Trusted publishers act as trusted users and can publish new versions of the crate automatically.
1614

1715
Trusted Publishing configuration:
1816

@@ -21,9 +19,6 @@ Trusted Publishing configuration:
2119
- Workflow filename: publish.yml
2220
- Environment: (not set)
2321

24-
If you did not make this change and you think it was made maliciously, you =
25-
can remove the configuration from the crate via the "Settings" tab on the c=
26-
rate's page.
22+
If you did not make this change and you think it was made maliciously, you can remove the configuration from the crate via the "Settings" tab on the crate's page.
2723

28-
If you are unable to revert the change and need to do so, you can email hel=
29-
p@crates.io to communicate with the crates.io support team.
24+
If you are unable to revert the change and need to do so, you can email help@crates.io to communicate with the crates.io support team.

src/controllers/trustpub/github_configs/delete/snapshots/crates_io__controllers__trustpub__github_configs__delete__tests__happy_path.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
crates.io user foo has remove a "Trusted Publishing" configuration for GitH=
14-
ub Actions from a crate that you manage (foo).
13+
crates.io user foo has remove a "Trusted Publishing" configuration for GitHub Actions from a crate that you manage (foo).
1514

1615
Trusted Publishing configuration:
1716

@@ -20,5 +19,4 @@ Trusted Publishing configuration:
2019
- Workflow filename: publish.yml
2120
- Environment: (not set)
2221

23-
If you did not make this change and you think it was made maliciously, you =
24-
can email help@crates.io to communicate with the crates.io support team.
22+
If you did not make this change and you think it was made maliciously, you can email help@crates.io to communicate with the crates.io support team.

src/tests/krate/publish/snapshots/crates_io__tests__krate__publish__basics__new_krate-4.snap

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new version of the package foo_new (1.0.0) was published by your account =
14-
(https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
13+
A new version of the package foo_new (1.0.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
1514

16-
If you have questions or security concerns, you can contact us at help@crat=
17-
es.io. If you would like to stop receiving these security notifications, yo=
18-
u can disable them in your account settings.
15+
If you have questions or security concerns, you can contact us at help@crates.io. If you would like to stop receiving these security notifications, you can disable them in your account settings.

src/tests/routes/me/tokens/snapshots/crates_io__tests__routes__me__tokens__create__create_token_success-2.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new API token with the name "bar" was recently added to your crates.io ac=
14-
count.
13+
A new API token with the name "bar" was recently added to your crates.io account.
1514

16-
If this wasn't you, you should revoke the token immediately: https://crates=
17-
.io/settings/tokens
15+
If this wasn't you, you should revoke the token immediately: https://crates.io/settings/tokens

src/tests/routes/me/tokens/snapshots/crates_io__tests__routes__me__tokens__create__create_token_with_expiry_date-2.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ Content-Transfer-Encoding: quoted-printable
1010

1111
Hello foo!
1212

13-
A new API token with the name "bar" was recently added to your crates.io ac=
14-
count.
13+
A new API token with the name "bar" was recently added to your crates.io account.
1514

16-
If this wasn't you, you should revoke the token immediately: https://crates=
17-
.io/settings/tokens
15+
If this wasn't you, you should revoke the token immediately: https://crates.io/settings/tokens

0 commit comments

Comments
 (0)