@@ -61,6 +61,31 @@ def test_create_tag_resource_id_not_in_config(self):
6161 self .assert_bad_request (response )
6262 assert ' not found in configuration' in response .data
6363
64+ def test_create_tag_resource_id_not_found (self ):
65+ data = self .get_example_data ()
66+ data ['Action' ] = 'CreateTags'
67+ data ['Tag.1.Key' ] = 'examplekey'
68+ data ['Tag.1.value' ] = 'examplevalue'
69+ data ['ResourceId.1' ] = 'exampleresourceid'
70+
71+
72+ data ['Signature' ] = generate_signature (data , 'POST' , 'localhost' , '/' )
73+
74+ get = mock .Mock ()
75+ get .return_value .text = read_file (
76+ 'tests/data/invalid_create_tag.json'
77+ )
78+ get .return_value .status_code = 200
79+
80+ with mock .patch ('requests.get' , get ):
81+ response = self .post (
82+ '/' ,
83+ data = data
84+ )
85+
86+ self .assert_bad_request (response )
87+ assert 'The specified ID for the resource you are trying to tag is not valid.' in response .data
88+
6489 def test_delete_tag (self ):
6590 data = self .get_example_data ()
6691 data ['Action' ] = 'DeleteTags'
@@ -109,6 +134,32 @@ def test_delete_tag_resource_id_not_in_config(self):
109134 self .assert_bad_request (response )
110135 assert ' not found in configuration' in response .data
111136
137+ def test_delete_tag_resource_id_not_found (self ):
138+ data = self .get_example_data ()
139+ data ['Action' ] = 'DeleteTags'
140+ data ['Tag.1.Key' ] = 'examplekey'
141+ data ['ResourceId.1' ] = 'exampleresourceid'
142+
143+
144+ data ['Signature' ] = generate_signature (data , 'POST' , 'localhost' , '/' )
145+
146+ get = mock .Mock ()
147+ get .return_value .text = read_file (
148+ 'tests/data/invalid_delete_tag.json'
149+ )
150+ get .return_value .status_code = 200
151+
152+ with mock .patch ('requests.get' , get ):
153+ response = self .post (
154+ '/' ,
155+ data = data
156+ )
157+
158+ print response .data
159+
160+ self .assert_bad_request (response )
161+ assert 'The specified ID for the resource you are trying to tag is not valid.' in response .data
162+
112163 def test_delete_keypair (self ):
113164 data = self .get_example_data ()
114165 data ['Action' ] = 'DeleteKeyPair'
0 commit comments