@@ -1558,7 +1558,6 @@ def test_rpc_v2_undefined_map_and_list_serialization():
15581558 "recoveryApproach" : "activePassive" ,
15591559 "primaryRegion" : "us-east-1" ,
15601560 "version" : "1" ,
1561- "updatedAt" : datetime (2025 , 9 , 16 , 14 , 54 , 5 , 262000 , tzinfo = tzlocal ()),
15621561 "executionRole" : "arn:aws:iam::671107678412:role/testswitch" ,
15631562 }
15641563 ]
@@ -1573,12 +1572,38 @@ def test_rpc_v2_undefined_map_and_list_serialization():
15731572 # this has been validated with AWS, AWS uses undefined length CBOR map and list
15741573 assert raw_response_body [:10 ] == b"\xbf eplans\x9f \xbf c"
15751574 assert raw_response_body [- 3 :] == b"\xff \xff \xff "
1575+
1576+
1577+ def test_rpc_v2_timestamp_serialization ():
1578+ service = load_service ("arc-region-switch" )
1579+ response_serializer = create_serializer (service , protocol = "smithy-rpc-v2-cbor" )
1580+ response_data = {
1581+ "plans" : [
1582+ {
1583+ "arn" : "arn:aws:arc-region-switch::671107678412:plan/TestPlan:a1b61f" ,
1584+ "owner" : "671107678412" ,
1585+ "name" : "TestPlan" ,
1586+ "regions" : ["us-east-1" , "us-east-2" ],
1587+ "recoveryApproach" : "activePassive" ,
1588+ "primaryRegion" : "us-east-1" ,
1589+ "version" : "1" ,
1590+ "updatedAt" : datetime (2025 , 9 , 16 , 14 , 54 , 5 , 262000 , tzinfo = tzutc ()),
1591+ "executionRole" : "arn:aws:iam::671107678412:role/testswitch" ,
1592+ }
1593+ ]
1594+ }
1595+
1596+ result : Response = response_serializer .serialize_to_response (
1597+ response_data , service .operation_model ("ListPlans" ), {}, long_uid ()
1598+ )
1599+ raw_response_body = result .data
15761600 # we also validate its timestamp serialization (with double)
15771601 timestamp_key_index = raw_response_body .find (b"updatedAt" )
15781602 timestamp_value_index = timestamp_key_index + len (b"updatedAt" )
15791603 # this has been validated with AWS as well, it encodes the timestamp as a double of length 8
15801604 assert (
1581- raw_response_body [timestamp_value_index : timestamp_value_index + 8 ] == b"\xc1 \xfb A\xda 2W{P"
1605+ raw_response_body [timestamp_value_index : timestamp_value_index + 8 ]
1606+ == b"\xc1 \xfb A\xda 2^\x83 P"
15821607 )
15831608
15841609
0 commit comments