-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add preferred username to user metadata
- Loading branch information
1 parent
6d0674f
commit 8fae6fb
Showing
2 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,6 +37,32 @@ async fn test_e2e_simple_sync() { | |
.expect("could not query Zitadel users"); | ||
|
||
assert!(user.is_some()); | ||
|
||
if let Some(user) = user { | ||
assert_eq!(user.user_name, "[email protected]"); | ||
|
||
if let Some(Type::Human(user)) = user.r#type { | ||
let profile = user.profile.expect("user lacks a profile"); | ||
let phone = user.phone.expect("user lacks a phone number)"); | ||
let email = user.email.expect("user lacks an email address"); | ||
|
||
assert_eq!(profile.first_name, "Bob"); | ||
assert_eq!(profile.last_name, "Tables"); | ||
assert_eq!(profile.display_name, "Tables, Bob"); | ||
assert_eq!(phone.phone, "+12015550123"); | ||
assert!(phone.is_phone_verified); | ||
assert_eq!(email.email, "[email protected]"); | ||
assert!(email.is_email_verified); | ||
} else { | ||
panic!("user lacks details"); | ||
} | ||
|
||
let preferred_username = zitadel | ||
.get_user_metadata(None, &user.id, "preferred_username") | ||
.await | ||
.expect("could not get user metadata"); | ||
assert_eq!(preferred_username, Some("Bobby".to_owned())); | ||
}; | ||
} | ||
|
||
#[test(tokio::test)] | ||
|