test: Handle emails more realistically in example data #1087
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.
Prompted by chat thread:
https://chat.zulip.org/#narrow/channel/516-mobile-dev-help/topic/ComposeAutocomplete.20test.20emailAddressVisbility.20help/near/1988541
(/cc @fombalang)
Commit messages
api test: Fix a test to use Account.copyWith when it means that
The "auth headers sent by default" test below assumes that the
request is made with the email and API key of
eg.selfAccount
.It happens to be true that
eg.account(user: eg.selfUser, …)
will get that email, but that's a bit of an accident about
how eg.account works and what data is on eg.selfUser.
Instead of
eg.account
, useeg.selfAccount.copyWith
, to makethe intention more explicit.
test: In eg.account use deliveryEmail or generate one, not user.email
This way we avoid using a source that in real data would be guaranteed
to be a fake email address: namely
user.email
for a user whereuser.deliveryEmail
is null.test: Cut specific emails in eg.selfUser, eg.otherUser, and friends
Most of our tests don't and shouldn't care what the specific email
address of a given user object is.
I think these were originally here because
eg.user
didn't generatefresh emails, so the caller needed to invent them in order to keep
them distinct. But since d1a2538 it does, and the caller needn't.
test: Make eg.user more realistic about email and delivery email
This better reflects the fact that a User object will often have
null
deliveryEmail
, and that when that's the case it will havea server-generated fake email address in
email
.