Error handling: Model-level validations, proper error responses.
This commit is contained in:
parent
b94401247f
commit
071c03e216
25 changed files with 616 additions and 287 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import boto
|
||||
from boto.exception import EC2ResponseError
|
||||
import sure # noqa
|
||||
from nose.tools import assert_raises
|
||||
|
||||
from moto import mock_ec2
|
||||
|
||||
|
|
@ -18,4 +19,9 @@ def test_console_output():
|
|||
@mock_ec2
|
||||
def test_console_output_without_instance():
|
||||
conn = boto.connect_ec2('the_key', 'the_secret')
|
||||
conn.get_console_output.when.called_with('i-1234abcd').should.throw(Exception)
|
||||
|
||||
with assert_raises(EC2ResponseError) as cm:
|
||||
conn.get_console_output('i-1234abcd')
|
||||
cm.exception.code.should.equal('InvalidInstanceID.NotFound')
|
||||
cm.exception.status.should.equal(400)
|
||||
cm.exception.request_id.should_not.be.none
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue