77from botocore .serialize import create_serializer
88
99from localstack .aws .protocol .parser import (
10+ CBORRequestParser ,
1011 OperationNotFoundParserError ,
1112 ProtocolParserError ,
1213 QueryRequestParser ,
@@ -626,7 +627,10 @@ def test_json_parser_cognito_with_botocore():
626627 )
627628
628629
629- def test_json_cbor_blob_parsing ():
630+ # TODO: once Kinesis supports multi protocols (json/cbor), update this test to select the protocol instead when
631+ # creating the parser
632+ @pytest .mark .parametrize ("parser_factory" , [CBORRequestParser , create_parser ])
633+ def test_json_cbor_blob_parsing (parser_factory ):
630634 serialized_request = {
631635 "url_path" : "/" ,
632636 "query_string" : "" ,
@@ -655,7 +659,7 @@ def test_json_cbor_blob_parsing():
655659 # Load the appropriate service
656660 service = load_service ("kinesis" )
657661 operation_model = service .operation_model ("PutRecord" )
658- parser = create_parser (service )
662+ parser = parser_factory (service )
659663 parsed_operation_model , parsed_request = parser .parse (
660664 HttpRequest (
661665 method = serialized_request .get ("method" ) or "GET" ,
@@ -678,7 +682,10 @@ def test_json_cbor_blob_parsing():
678682 assert parsed_request ["PartitionKey" ] == "partitionkey"
679683
680684
681- def test_json_cbor_blob_parsing_w_timestamp (snapshot ):
685+ # TODO: once Kinesis supports multi protocols (json/cbor), update this test to select the protocol instead when
686+ # creating the parser
687+ @pytest .mark .parametrize ("parser_factory" , [CBORRequestParser , create_parser ])
688+ def test_json_cbor_blob_parsing_w_timestamp (snapshot , parser_factory ):
682689 serialized_request = {
683690 "url_path" : "/" ,
684691 "query_string" : "" ,
@@ -707,7 +714,7 @@ def test_json_cbor_blob_parsing_w_timestamp(snapshot):
707714 # Load the appropriate service
708715 service = load_service ("kinesis" )
709716 operation_model = service .operation_model ("SubscribeToShard" )
710- parser = create_parser (service )
717+ parser = parser_factory (service )
711718 parsed_operation_model , parsed_request = parser .parse (
712719 HttpRequest (
713720 method = serialized_request .get ("method" ),
@@ -721,6 +728,7 @@ def test_json_cbor_blob_parsing_w_timestamp(snapshot):
721728
722729 # Check if the determined operation_model is correct
723730 assert parsed_operation_model == operation_model
731+ assert isinstance (parsed_request ["StartingPosition" ]["Timestamp" ], datetime )
724732 snapshot .match ("parsed_request" , parsed_request )
725733
726734
0 commit comments