f4b81e69b8
* Address `boto` deprecation warnings This commit eliminates the following warning: ../boto/ec2/connection.py:582: PendingDeprecationWarning: The current get_all_instances implementation will be replaced with get_all_reservations. `boto` isn't likely to ever make good on this warning, but doing the replacement will declutter the `moto` test output. * Remove `invoke_lambda` tracebacks from unit test logging If an exception is encountered, the details are returned in the response payload. Printing the traceback was just adding noise to the pytest output. * Use known AMIs in unit tests This commit eliminates the following warning in the pytest output: `PendingDeprecationWarning: Could not find AMI with image-id:ami-123456, in the near future this will cause an error.` Known, pre-loaded AMI image ids are used instead of random ids that don't actually exist in the moto backend. The integrity of the tests is unaffected by this change. A test has been added to provide explicit coverage of the PendingDeprecationWarning raised when an invalid AMI image id is passed to moto.
30 lines
736 B
Python
30 lines
736 B
Python
from __future__ import unicode_literals
|
|
import unittest
|
|
|
|
from boto.sqs.connection import SQSConnection
|
|
from boto.sqs.message import Message
|
|
from boto.ec2 import EC2Connection
|
|
|
|
from moto import mock_sqs_deprecated, mock_ec2_deprecated
|
|
from tests import EXAMPLE_AMI_ID
|
|
|
|
|
|
class TestNestedDecorators(unittest.TestCase):
|
|
@mock_sqs_deprecated
|
|
def setup_sqs_queue(self):
|
|
conn = SQSConnection()
|
|
q = conn.create_queue("some-queue")
|
|
|
|
m = Message()
|
|
m.set_body("This is my first message.")
|
|
q.write(m)
|
|
|
|
self.assertEqual(q.count(), 1)
|
|
|
|
@mock_ec2_deprecated
|
|
def test_nested(self):
|
|
self.setup_sqs_queue()
|
|
|
|
conn = EC2Connection()
|
|
conn.run_instances(EXAMPLE_AMI_ID)
|