A class to mock IAMConnection
.
Application developers may want to test their code with simulated responses, including errors, from an object of type IAMClient
. To do so, construct an object of type IAMClient
with an instance of this class. Then use the Google Test framework functions to program the behavior of this mock.
See Also
This example for how to test your application with GoogleTest. While the example showcases types from the BigQuery library, the underlying principles apply for any pair of *Client
and *Connection
.
Functions
virtual options()
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Returns |
Type |
Description |
Options |
|
virtual ListServiceAccounts(google::iam::admin::v1::ListServiceAccountsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::ListServiceAccountsRequest
|
Returns |
Type |
Description |
StreamRange< google::iam::admin::v1::ServiceAccount > |
|
virtual GetServiceAccount(google::iam::admin::v1::GetServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::GetServiceAccountRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccount > |
|
virtual CreateServiceAccount(google::iam::admin::v1::CreateServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::CreateServiceAccountRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccount > |
|
virtual PatchServiceAccount(google::iam::admin::v1::PatchServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::PatchServiceAccountRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccount > |
|
virtual DeleteServiceAccount(google::iam::admin::v1::DeleteServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::DeleteServiceAccountRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual UndeleteServiceAccount(google::iam::admin::v1::UndeleteServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::UndeleteServiceAccountRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::UndeleteServiceAccountResponse > |
|
virtual EnableServiceAccount(google::iam::admin::v1::EnableServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::EnableServiceAccountRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual DisableServiceAccount(google::iam::admin::v1::DisableServiceAccountRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::DisableServiceAccountRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual ListServiceAccountKeys(google::iam::admin::v1::ListServiceAccountKeysRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::ListServiceAccountKeysRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ListServiceAccountKeysResponse > |
|
virtual GetServiceAccountKey(google::iam::admin::v1::GetServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::GetServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccountKey > |
|
virtual CreateServiceAccountKey(google::iam::admin::v1::CreateServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::CreateServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccountKey > |
|
virtual UploadServiceAccountKey(google::iam::admin::v1::UploadServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::UploadServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::ServiceAccountKey > |
|
virtual DeleteServiceAccountKey(google::iam::admin::v1::DeleteServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::DeleteServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual DisableServiceAccountKey(google::iam::admin::v1::DisableServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::DisableServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual EnableServiceAccountKey(google::iam::admin::v1::EnableServiceAccountKeyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::EnableServiceAccountKeyRequest const &
|
Returns |
Type |
Description |
Status |
|
virtual GetIamPolicy(google::iam::v1::GetIamPolicyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::GetIamPolicyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::Policy > |
|
virtual SetIamPolicy(google::iam::v1::SetIamPolicyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::SetIamPolicyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::Policy > |
|
virtual TestIamPermissions(google::iam::v1::TestIamPermissionsRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::v1::TestIamPermissionsRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::v1::TestIamPermissionsResponse > |
|
virtual QueryGrantableRoles(google::iam::admin::v1::QueryGrantableRolesRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::QueryGrantableRolesRequest
|
Returns |
Type |
Description |
StreamRange< google::iam::admin::v1::Role > |
|
virtual ListRoles(google::iam::admin::v1::ListRolesRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::ListRolesRequest
|
Returns |
Type |
Description |
StreamRange< google::iam::admin::v1::Role > |
|
virtual GetRole(google::iam::admin::v1::GetRoleRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::GetRoleRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::Role > |
|
virtual CreateRole(google::iam::admin::v1::CreateRoleRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::CreateRoleRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::Role > |
|
virtual UpdateRole(google::iam::admin::v1::UpdateRoleRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::UpdateRoleRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::Role > |
|
virtual DeleteRole(google::iam::admin::v1::DeleteRoleRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::DeleteRoleRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::Role > |
|
virtual UndeleteRole(google::iam::admin::v1::UndeleteRoleRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::UndeleteRoleRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::Role > |
|
virtual QueryTestablePermissions(google::iam::admin::v1::QueryTestablePermissionsRequest)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::QueryTestablePermissionsRequest
|
Returns |
Type |
Description |
StreamRange< google::iam::admin::v1::Permission > |
|
virtual QueryAuditableServices(google::iam::admin::v1::QueryAuditableServicesRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::QueryAuditableServicesRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::QueryAuditableServicesResponse > |
|
virtual LintPolicy(google::iam::admin::v1::LintPolicyRequest const &)
This function is implemented using gMock's MOCK_METHOD()
.
Consult the gMock documentation to use this mock in your tests.
Parameter |
Name |
Description |
request |
google::iam::admin::v1::LintPolicyRequest const &
|
Returns |
Type |
Description |
StatusOr< google::iam::admin::v1::LintPolicyResponse > |
|