-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[commtest][identity] Add test for FindUserID RPC
Summary: Added integration test for FindUserID RPC added in D9834. Depends on D9834 Test Plan: The test passes locally and on CI Reviewers: kamil, michal, varun, wyilio Reviewed By: varun Subscribers: ashoat, tomek, wyilio Differential Revision: https://phab.comm.dev/D9835
- Loading branch information
Showing
2 changed files
with
41 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,40 @@ | ||
use commtest::identity::device::{ | ||
create_device, DEVICE_TYPE, PLACEHOLDER_CODE_VERSION, | ||
}; | ||
use commtest::service_addr; | ||
use grpc_clients::identity::protos::authenticated::find_user_id_request::Identifier; | ||
use grpc_clients::identity::{ | ||
get_auth_client, protos::authenticated::FindUserIdRequest, | ||
}; | ||
|
||
#[tokio::test] | ||
async fn find_user_id_by_username() { | ||
let device_info = create_device(None).await; | ||
|
||
let mut client = get_auth_client( | ||
&service_addr::IDENTITY_GRPC.to_string(), | ||
device_info.user_id.clone(), | ||
device_info.device_id, | ||
device_info.access_token, | ||
PLACEHOLDER_CODE_VERSION, | ||
DEVICE_TYPE.to_string(), | ||
) | ||
.await | ||
.expect("Couldn't connect to identity service"); | ||
|
||
let request = FindUserIdRequest { | ||
identifier: Some(Identifier::Username(device_info.username)), | ||
}; | ||
|
||
let response = client | ||
.find_user_id(request) | ||
.await | ||
.expect("Request failed") | ||
.into_inner(); | ||
|
||
assert_eq!( | ||
response.user_id, | ||
Some(device_info.user_id), | ||
"User ID should match" | ||
); | ||
} |