Use UserBuilder in more tests - #14238
Merged
Merged
Conversation
Turbo87
reviewed
Jul 15, 2026
| [dev-dependencies] | ||
| claims = "=0.8.0" | ||
| crates_io_test_db = { path = "../crates_io_test_db" } | ||
| crates_io_test_utils = { path = "../crates_io_test_utils" } |
Member
There was a problem hiding this comment.
hmm... I'm feeling a bit uneasy about adding this to the database crate since it pulls in:
crates_io_api_types = { path = "../crates_io_api_types" }
crates_io_cargo_toml = { path = "../crates_io_cargo_toml" }
crates_io_database = { path = "../crates_io_database" }
crates_io_encryption = { path = "../crates_io_encryption" }
crates_io_linecount = { path = "../crates_io_linecount" }
crates_io_tarball = { path = "../crates_io_tarball", features = ["builder"] }that creates quite a spaghetti in the dependency tree 😅
Member
Author
There was a problem hiding this comment.
ok 🤷🏻♀️ i put it back the way it was!
LawnGnome
approved these changes
Jul 15, 2026
| @@ -22,6 +22,7 @@ static ENCRYPTED_TOKEN: LazyLock<Vec<u8>> = LazyLock::new(|| { | |||
| /// If you want to test logic that happens as part of signing up or logging in, | |||
| pub struct UserBuilder<'a> { | |||
Contributor
There was a problem hiding this comment.
Wondering at what point we would want to pull bon in, but probably not at two fields.
| id: 1, | ||
| gh_login: self.username.into(), | ||
| name: Some("The Octocat".into()), | ||
| name: self.display_name.map(ToString::to_string), |
Contributor
There was a problem hiding this comment.
This is technically a change in behaviour, but since the CI is green I'm assuming we weren't relying on it anywhere.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As we remove
gh_*fields from user records, using theUserBuilderin more places now means fewer places will need to be updated to remove thegh_*fields when we deprecate those since theUserBuilderconsolidates setting thegh_*fields on the test user records to one place.There are still a few places that I've deliberately not used
UserBuilder, such as:is_adminin the sync admins job, not the regular user flowusers.gh_idis -1, which is still a thing in production