Skip to content
Permalink
Browse files
Test invalid attribute on attribute description functions
  • Loading branch information
brogand93 committed Mar 1, 2014
1 parent 27ee735 commit 3d052a8deb9930cd0a734ea1679d38471807d643
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 2 deletions.
File renamed without changes.
File renamed without changes.
@@ -102,7 +102,7 @@ def test_describe_image_attribute(self):

get = mock.Mock()
get.return_value.text = read_file(
'tests/data/valid_describe_image_attribute.json'
'tests/data/valid_describe_image.json'
)
get.return_value.status_code = 200

@@ -114,3 +114,25 @@ def test_describe_image_attribute(self):

self.assert_ok(response)
assert 'DescribeImageAttributeResponse' in response.data

def test_describe_invalid_image_attribute(self):
data = self.get_example_data()
data['Action'] = 'DescribeImageAttribute'
data['ImageId'] = 'a32d70ee-95e4-11e3-b2e4-d19c9d3e5e1d'
data['Attribute'] = 'invalid_attribute'
data['Signature'] = generate_signature(data, 'POST', 'localhost')

get = mock.Mock()
get.return_value.text = read_file(
'tests/data/valid_describe_image.json'
)
get.return_value.status_code = 200

with mock.patch('requests.get', get):
response = self.post(
'/',
data=data
)

self.assert_bad_request(response)
assert 'InvalidParameterValue' in response.data
@@ -102,7 +102,7 @@ def test_describe_instance_attribute(self):

get = mock.Mock()
get.return_value.text = read_file(
'tests/data/valid_describe_instance_attribute.json'
'tests/data/valid_describe_instance.json'
)
get.return_value.status_code = 200

@@ -114,3 +114,27 @@ def test_describe_instance_attribute(self):

self.assert_ok(response)
assert 'DescribeInstanceAttributeResponse' in response.data

def test_describe_invalid_instance_attribute(self):
data = self.get_example_data()
data['Action'] = 'DescribeInstanceAttribute'
data['InstanceId'] = '43791f77-26f8-48ca-b557-3a9392f735ae'
data['Attribute'] = 'invalid_attribute'
data['Signature'] = generate_signature(data, 'POST', 'localhost')

get = mock.Mock()
get.return_value.text = read_file(
'tests/data/valid_describe_instance.json'
)
get.return_value.status_code = 200

with mock.patch('requests.get', get):
response = self.post(
'/',
data=data
)

self.assert_bad_request(response)
assert 'InvalidParameterValue' in response.data


0 comments on commit 3d052a8

Please sign in to comment.