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

src/tests/routes/me/tokens/snapshots/crates_io__tests__routes__me__tokens__create__create_token_with_null_scopes-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_scopes-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/users/update/snapshots/crates_io__tests__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-3.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 @@ Hello foo!
2825

2926
You have been unsubscribed from publish notifications.
3027

31-
If you would like to resubscribe, please visit https://crates.io/settings/p=
32-
rofile
28+
If you would like to resubscribe, please visit https://crates.io/settings/profile

src/tests/routes/users/update/snapshots/crates_io__tests__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-4.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 @@ Hello foo!
2825

2926
You have been unsubscribed from publish notifications.
3027

31-
If you would like to resubscribe, please visit https://crates.io/settings/p=
32-
rofile
28+
If you would like to resubscribe, please visit https://crates.io/settings/profile

src/tests/routes/users/update/snapshots/crates_io__tests__routes__users__update__publish_notifications__unsubscribe_and_resubscribe-6.snap

Lines changed: 5 additions & 12 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,8 +25,7 @@ Hello foo!
2825

2926
You have been unsubscribed from publish notifications.
3027

31-
If you would like to resubscribe, please visit https://crates.io/settings/p=
32-
rofile
28+
If you would like to resubscribe, please visit https://crates.io/settings/profile
3329
----------------------------------------
3430

3531
To: foo@example.com
@@ -40,9 +36,6 @@ Content-Transfer-Encoding: quoted-printable
4036

4137
Hello foo!
4238

43-
A new version of the package foo (1.2.0) was published by your account (htt=
44-
ps://crates.io/users/foo) at [0000-00-00T00:00:00Z].
39+
A new version of the package foo (1.2.0) was published by your account (https://crates.io/users/foo) at [0000-00-00T00:00:00Z].
4540

46-
If you have questions or security concerns, you can contact us at help@crat=
47-
es.io. If you would like to stop receiving these security notifications, yo=
48-
u can disable them in your account settings.
41+
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/users/update/snapshots/crates_io__tests__routes__users__update__publish_notifications__unsubscribe_and_resubscribe.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 (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.

src/tests/snapshots/crates_io__tests__github_secret_scanning__github_secret_alert_revokes_token-2.snap

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ Subject: crates.io: Your API token "bar" has been revoked
88
Content-Type: text/plain; charset=utf-8
99
Content-Transfer-Encoding: quoted-printable
1010

11-
GitHub has notified us that your crates.io API token bar has been exposed p=
12-
ublicly. We have revoked this token as a precaution.
11+
GitHub has notified us that your crates.io API token bar has been exposed publicly. We have revoked this token as a precaution.
1312

14-
Please review your account at https://crates.io to confirm that no unexpect=
15-
ed changes have been made to your settings or crates.
13+
Please review your account at https://crates.io to confirm that no unexpected changes have been made to your settings or crates.
1614

1715
Source type: some_source
1816

src/tests/snapshots/crates_io__tests__owners__modify_multiple_owners-6.snap

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

1111
foo has invited you to become an owner of the crate owners_multiple!
1212

13-
Visit https://crates.io/accept-invite/[invite-token] to accept =
14-
this invitation,
15-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
16-
wnership invitations.
13+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
14+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.
1715
----------------------------------------
1816

1917
To: user3@example.com
@@ -24,10 +22,8 @@ Content-Transfer-Encoding: quoted-printable
2422

2523
foo has invited you to become an owner of the crate owners_multiple!
2624

27-
Visit https://crates.io/accept-invite/[invite-token] to accept =
28-
this invitation,
29-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
30-
wnership invitations.
25+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
26+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.
3127
----------------------------------------
3228

3329
To: user2@example.com
@@ -38,10 +34,8 @@ Content-Transfer-Encoding: quoted-printable
3834

3935
foo has invited you to become an owner of the crate owners_multiple!
4036

41-
Visit https://crates.io/accept-invite/[invite-token] to accept =
42-
this invitation,
43-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
44-
wnership invitations.
37+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
38+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.
4539
----------------------------------------
4640

4741
To: user3@example.com
@@ -52,7 +46,5 @@ Content-Transfer-Encoding: quoted-printable
5246

5347
foo has invited you to become an owner of the crate owners_multiple!
5448

55-
Visit https://crates.io/accept-invite/[invite-token] to accept =
56-
this invitation,
57-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
58-
wnership invitations.
49+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
50+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.

src/tests/snapshots/crates_io__tests__owners__modify_multiple_owners.snap

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

1111
foo has invited you to become an owner of the crate owners_multiple!
1212

13-
Visit https://crates.io/accept-invite/[invite-token] to accept =
14-
this invitation,
15-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
16-
wnership invitations.
13+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
14+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.
1715
----------------------------------------
1816

1917
To: user3@example.com
@@ -24,7 +22,5 @@ Content-Transfer-Encoding: quoted-printable
2422

2523
foo has invited you to become an owner of the crate owners_multiple!
2624

27-
Visit https://crates.io/accept-invite/[invite-token] to accept =
28-
this invitation,
29-
or go to https://crates.io/me/pending-invites to manage all of your crate o=
30-
wnership invitations.
25+
Visit https://crates.io/accept-invite/[invite-token] to accept this invitation,
26+
or go to https://crates.io/me/pending-invites to manage all of your crate ownership invitations.

0 commit comments

Comments
 (0)