Class MockSnapshotsConnection (2.23.0-rc)

A class to mock SnapshotsConnection.

Application developers may want to test their code with simulated responses, including errors, from an object of type SnapshotsClient. To do so, construct an object of type SnapshotsClient 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
TypeDescription
Options

virtual DeleteSnapshot(google::cloud::cpp::compute::snapshots::v1::DeleteSnapshotRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::DeleteSnapshotRequest const &
Returns
TypeDescription
future< StatusOr< google::cloud::cpp::compute::v1::Operation > >

virtual GetSnapshot(google::cloud::cpp::compute::snapshots::v1::GetSnapshotRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::GetSnapshotRequest const &
Returns
TypeDescription
StatusOr< google::cloud::cpp::compute::v1::Snapshot >

virtual GetIamPolicy(google::cloud::cpp::compute::snapshots::v1::GetIamPolicyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::GetIamPolicyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::cpp::compute::v1::Policy >

virtual InsertSnapshot(google::cloud::cpp::compute::snapshots::v1::InsertSnapshotRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::InsertSnapshotRequest const &
Returns
TypeDescription
future< StatusOr< google::cloud::cpp::compute::v1::Operation > >

virtual ListSnapshots(google::cloud::cpp::compute::snapshots::v1::ListSnapshotsRequest)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::ListSnapshotsRequest
Returns
TypeDescription
StreamRange< google::cloud::cpp::compute::v1::Snapshot >

virtual SetIamPolicy(google::cloud::cpp::compute::snapshots::v1::SetIamPolicyRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::SetIamPolicyRequest const &
Returns
TypeDescription
StatusOr< google::cloud::cpp::compute::v1::Policy >

virtual SetLabels(google::cloud::cpp::compute::snapshots::v1::SetLabelsRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::SetLabelsRequest const &
Returns
TypeDescription
future< StatusOr< google::cloud::cpp::compute::v1::Operation > >

virtual TestIamPermissions(google::cloud::cpp::compute::snapshots::v1::TestIamPermissionsRequest const &)

This function is implemented using gMock's MOCK_METHOD(). Consult the gMock documentation to use this mock in your tests.

Parameter
NameDescription
request google::cloud::cpp::compute::snapshots::v1::TestIamPermissionsRequest const &
Returns
TypeDescription
StatusOr< google::cloud::cpp::compute::v1::TestPermissionsResponse >