Skip to content

Commit

Permalink
[commtest][identity] Add test for FindUserID RPC
Browse files Browse the repository at this point in the history
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
barthap committed Nov 16, 2023
1 parent 2d1b959 commit 1bf5728
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
1 change: 1 addition & 0 deletions services/commtest/run-tests-ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ run_test "backup*"
run_test "tunnelbroker_*" --test-threads=1
run_test grpc_client_test
# below tests are flaky and need to be run in order
run_test identity_integration_tests
run_test identity_keyserver_tests
run_test identity_access_tokens_tests
run_test identity_one_time_key_tests
Expand Down
40 changes: 40 additions & 0 deletions services/commtest/tests/identity_integration_tests.rs
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"
);
}

0 comments on commit 1bf5728

Please sign in to comment.