Ejemplo n.º 1
0
 def test_get_conn_with_no_auth_params_raises_invocation_error(self):
     with patch(
             "boto.{0}.connect_to_region".format(service),
             side_effect=boto.exception.NoAuthHandlerFound(),
     ):
         with self.assertRaises(SaltInvocationError):
             botomod.get_connection(service)
Ejemplo n.º 2
0
 def test_get_conn_error_raises_command_execution_error(self):
     with patch('boto.{0}.connect_to_region'.format(service),
                side_effect=BotoServerError(400,
                                            'Mocked error',
                                            body=error_body)):
         with self.assertRaises(BotoServerError):
             botomod.get_connection(service)
Ejemplo n.º 3
0
 def test_get_conn_error_raises_command_execution_error(self):
     with patch(
             "boto.{}.connect_to_region".format(service),
             side_effect=BotoServerError(400,
                                         "Mocked error",
                                         body=error_body),
     ):
         with pytest.raises(BotoServerError):
             botomod.get_connection(service)
Ejemplo n.º 4
0
    def test_context_conflict_between_boto_and_boto3_utils(self):
        botomod.assign_funcs(__name__, "ec2")
        boto3mod.assign_funcs(__name__, "ec2", get_conn_funcname="_get_conn3")

        boto_ec2_conn = botomod.get_connection("ec2",
                                               region=region,
                                               key=secret_key,
                                               keyid=access_key)
        boto3_ec2_conn = boto3mod.get_connection("ec2",
                                                 region=region,
                                                 key=secret_key,
                                                 keyid=access_key)

        # These should *not* be the same object!
        self.assertNotEqual(id(boto_ec2_conn), id(boto3_ec2_conn))
Ejemplo n.º 5
0
 def test_conn_is_cache_with_profile(self):
     conn = botomod.get_connection(service, profile=conn_parameters)
     self.assertTrue(conn in botomod.__context__.values())
Ejemplo n.º 6
0
 def test_conn_is_cached(self):
     conn = botomod.get_connection(service, **conn_parameters)
     self.assertTrue(conn in botomod.__context__.values())