Merge pull request #230 from joekiller/fix_unsupported_metadata
raise NotImplementedError on unknown metadata path
This commit is contained in:
commit
9559c6f746
@ -158,4 +158,6 @@ def metadata_response(request, full_url, headers):
|
||||
result = 'default-role'
|
||||
elif path == 'iam/security-credentials/default-role':
|
||||
result = json.dumps(credentials)
|
||||
else:
|
||||
raise NotImplementedError("The {0} metadata path has not been implemented".format(path))
|
||||
return 200, headers, result
|
||||
|
@ -1,4 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
import sure # noqa
|
||||
from nose.tools import assert_raises
|
||||
import requests
|
||||
|
||||
from moto import mock_ec2
|
||||
@ -35,3 +37,9 @@ def test_meta_data_default_role():
|
||||
json_response.should.contain('SecretAccessKey')
|
||||
json_response.should.contain('Token')
|
||||
json_response.should.contain('Expiration')
|
||||
|
||||
|
||||
@mock_ec2
|
||||
def test_meta_data_unknown_path():
|
||||
with assert_raises(NotImplementedError):
|
||||
requests.get("http://169.254.169.254/latest/meta-data/badpath")
|
||||
|
Loading…
Reference in New Issue
Block a user