#NEWLINE# def test_describe_tags( self ) : #NEWLINE# #INDENT# self . db_api . get_tags . return_value = [ { #NEWLINE# #INDENT# 'item_id' : fakes . ID_EC2_VPC_1 , #NEWLINE# 'key' : 'key1' , #NEWLINE# 'value' : '' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'item_id' : fakes . ID_EC2_VPC_2 , #NEWLINE# 'key' : 'key2' , #NEWLINE# 'value' : 'value2' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'item_id' : fakes . ID_EC2_VPC_2 , #NEWLINE# 'key' : 'key1' , #NEWLINE# 'value' : 'value3' , #NEWLINE# #UNINDENT# } ] #NEWLINE# resp = self . execute ( 'DescribeTags' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertThat ( resp , matchers . DictMatches ( { #NEWLINE# #INDENT# 'tagSet' : [ { #NEWLINE# #INDENT# 'resourceType' : 'vpc' , #NEWLINE# 'resourceId' : fakes . ID_EC2_VPC_1 , #NEWLINE# 'key' : 'key1' , #NEWLINE# 'value' : None , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'resourceType' : 'vpc' , #NEWLINE# 'resourceId' : fakes . ID_EC2_VPC_2 , #NEWLINE# 'key' : 'key2' , #NEWLINE# 'value' : 'value2' , #NEWLINE# #UNINDENT# } , { #NEWLINE# #INDENT# 'resourceType' : 'vpc' , #NEWLINE# 'resourceId' : fakes . ID_EC2_VPC_2 , #NEWLINE# 'key' : 'key1' , #NEWLINE# 'value' : 'value3' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , orderless_lists = True ) , verbose = True ) #NEWLINE# self . check_filtering ( 'DescribeTags' , 'tagSet' , [ ( 'resource-type' , 'vpc' ) , ( 'resource-id' , fakes . ID_EC2_VPC_1 ) , ( 'key' , 'key1' ) , ( 'value' , 'value2' ) ] ) #NEWLINE# for ( r_id , r_type ) in [ ( 'dopt' , 'dhcp-options' ) , ( 'ami' , 'image' ) , ( 'aki' , 'image' ) , ( 'ari' , 'image' ) , ( 'cgw' , 'customer-gateway' ) , ( 'i' , 'instance' ) , ( 'igw' , 'internet-gateway' ) , ( 'eni' , 'network-interface' ) , ( 'rtb' , 'route-table' ) , ( 'snap' , 'snapshot' ) , ( 'subnet' , 'subnet' ) , ( 'sg' , 'security-group' ) , ( 'vgw' , 'vpn-gateway' ) , ( 'vol' , 'volume' ) , ( 'vpc' , 'vpc' ) , ( 'vpn' , 'vpn-connection' ) ] : #NEWLINE# #INDENT# item_id = fakes . random_ec2_id ( r_id ) #NEWLINE# self . db_api . get_tags . return_value = [ { #NEWLINE# #INDENT# 'item_id' : resp , #NEWLINE# 'key' : 'fake-key' , #NEWLINE# 'value' : 'fake-value' , #NEWLINE# #UNINDENT# } ] #NEWLINE# resp = self . execute ( 'DescribeTags' , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# self . assertEqual ( { #NEWLINE# #INDENT# 'tagSet' : [ { #NEWLINE# #INDENT# 'resourceType' : r_type , #NEWLINE# 'resourceId' : item_id , #NEWLINE# 'key' : 'fake-key' , #NEWLINE# 'value' : 'fake-value' , #NEWLINE# #UNINDENT# } ] , #NEWLINE# #UNINDENT# } , resp )