A class to mock DeviceManagerConnection
.
Application developers may want to test their code with simulated responses, including errors, from an object of type DeviceManagerClient
. To do so, construct an object of type DeviceManagerClient
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 CreateDeviceRegistry(google::cloud::iot::v1::CreateDeviceRegistryRequest 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::cloud::iot::v1::CreateDeviceRegistryRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > | |
virtual GetDeviceRegistry(google::cloud::iot::v1::GetDeviceRegistryRequest 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::cloud::iot::v1::GetDeviceRegistryRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > | |
virtual UpdateDeviceRegistry(google::cloud::iot::v1::UpdateDeviceRegistryRequest 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::cloud::iot::v1::UpdateDeviceRegistryRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceRegistry > | |
virtual DeleteDeviceRegistry(google::cloud::iot::v1::DeleteDeviceRegistryRequest 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::cloud::iot::v1::DeleteDeviceRegistryRequest const &
|
Returns |
---|
Type | Description |
Status | |
virtual ListDeviceRegistries(google::cloud::iot::v1::ListDeviceRegistriesRequest)
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::cloud::iot::v1::ListDeviceRegistriesRequest
|
Returns |
---|
Type | Description |
StreamRange< google::cloud::iot::v1::DeviceRegistry > | |
virtual CreateDevice(google::cloud::iot::v1::CreateDeviceRequest 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::cloud::iot::v1::CreateDeviceRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > | |
virtual GetDevice(google::cloud::iot::v1::GetDeviceRequest 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::cloud::iot::v1::GetDeviceRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > | |
virtual UpdateDevice(google::cloud::iot::v1::UpdateDeviceRequest 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::cloud::iot::v1::UpdateDeviceRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::Device > | |
virtual DeleteDevice(google::cloud::iot::v1::DeleteDeviceRequest 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::cloud::iot::v1::DeleteDeviceRequest const &
|
Returns |
---|
Type | Description |
Status | |
virtual ListDevices(google::cloud::iot::v1::ListDevicesRequest)
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::cloud::iot::v1::ListDevicesRequest
|
Returns |
---|
Type | Description |
StreamRange< google::cloud::iot::v1::Device > | |
virtual ModifyCloudToDeviceConfig(google::cloud::iot::v1::ModifyCloudToDeviceConfigRequest 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::cloud::iot::v1::ModifyCloudToDeviceConfigRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::DeviceConfig > | |
virtual ListDeviceConfigVersions(google::cloud::iot::v1::ListDeviceConfigVersionsRequest 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::cloud::iot::v1::ListDeviceConfigVersionsRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceConfigVersionsResponse > | |
virtual ListDeviceStates(google::cloud::iot::v1::ListDeviceStatesRequest 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::cloud::iot::v1::ListDeviceStatesRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::ListDeviceStatesResponse > | |
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 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 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 SendCommandToDevice(google::cloud::iot::v1::SendCommandToDeviceRequest 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::cloud::iot::v1::SendCommandToDeviceRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::SendCommandToDeviceResponse > | |
virtual BindDeviceToGateway(google::cloud::iot::v1::BindDeviceToGatewayRequest 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::cloud::iot::v1::BindDeviceToGatewayRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::BindDeviceToGatewayResponse > | |
virtual UnbindDeviceFromGateway(google::cloud::iot::v1::UnbindDeviceFromGatewayRequest 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::cloud::iot::v1::UnbindDeviceFromGatewayRequest const &
|
Returns |
---|
Type | Description |
StatusOr< google::cloud::iot::v1::UnbindDeviceFromGatewayResponse > | |