You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Aug 25, 2026. It is now read-only.
Comparison fails for unit tests with timestamps #897
This looks like #508, probably appearing again as the current logic checks for a string match of the field.ident and that changed in #851.
________________________________________________ test_set_finding_state_flattened_async _________________________________________________
@pytest.mark.asyncio
async def test_set_finding_state_flattened_async():
client = SecurityCenterAsyncClient(
credentials=ga_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.return_value = grpc_helpers_async.FakeUnaryUnaryCall(finding.Finding())
# Call the method with a truthy value for each flattened field,
# using the keyword arguments to the method.
response = await client.set_finding_state(
name="name_value",
state=finding.Finding.State.ACTIVE,
start_time=timestamp_pb2.Timestamp(seconds=751),
)
# Establish that the underlying call was made with the expected
# request object values.
assert len(call.mock_calls)
_, 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_pb2.Timestamp(seconds=751)
E assert DatetimeWithNanoseconds(1970, 1, 1, 0, 12, 31, tzinfo=datetime.timezone.utc) == seconds: 751\n
E + where DatetimeWithNanoseconds(1970, 1, 1, 0, 12, 31, tzinfo=datetime.timezone.utc) = name: "name_value"\nstate: ACTIVE\nstart_time {\n seconds: 751\n}\n.start_time
E + and seconds: 751\n = <class 'google.protobuf.timestamp_pb2.Timestamp'>(seconds=751)
E + where <class 'google.protobuf.timestamp_pb2.Timestamp'> = timestamp_pb2.Timestamp
tests/unit/gapic/securitycenter_v1beta1/test_security_center.py:3670: AssertionError
Activity
fix: fix datetime comparison unit tests (#898)