Skip to content

Commit

Permalink
Mock https connection in ecs test
Browse files Browse the repository at this point in the history
Makes this consistent with the EC2 unit tests.
  • Loading branch information
jamesls committed Jul 8, 2016
1 parent 250d891 commit c969b13
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion tests/unit/ec2containerservice/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
# IN THE SOFTWARE.
#
import httplib
from mock import Mock
from tests.unit import unittest

import boto.ec2containerservice
Expand All @@ -28,6 +30,15 @@

class TestConnectToRegion(unittest.TestCase):

def setUp(self):
self.https_connection = Mock(spec=httplib.HTTPSConnection)
self.https_connection_factory = (
Mock(return_value=self.https_connection), ())

def test_aws_region(self):
ecs = boto.ec2containerservice.connect_to_region('us-east-1')
ecs = boto.ec2containerservice.connect_to_region('us-east-1',
https_connection_factory=self.https_connection_factory,
aws_access_key_id='aws_access_key_id',
aws_secret_access_key='aws_secret_access_key'
)
self.assertIsInstance(ecs, EC2ContainerServiceConnection)

0 comments on commit c969b13

Please sign in to comment.