-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Labels
type: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.
Description
def test_set_finding_state_flattened():
client = SecurityCenterClient(credentials=credentials.AnonymousCredentials(),)
# Mock the actual call within the gRPC stub, and fake the request.
with mock.patch.object(
type(client._transport.set_finding_state), "__call__"
) as call:
# Designate an appropriate return value for the call.
call.return_value = finding.Finding()
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
client.set_finding_state(
name="name_value",
state=finding.Finding.State.ACTIVE,
start_time=timestamp.Timestamp(seconds=751),
)
# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls) == 1
_, args, _ = call.mock_calls[0]
assert args[0].name == "name_value"
assert args[0].state == finding.Finding.State.ACTIVE
assert args[0].start_time == timestamp.Timestamp(seconds=751)args[0].start_time is a Python datetime object and the assert fails.
Metadata
Metadata
Assignees
Labels
type: cleanupAn internal cleanup or hygiene concern.An internal cleanup or hygiene concern.