Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_elb_create_elb(mock_get_properties, mock_elb_json, mock_wait_for_task, mock_listener_policy,
mock_backend_policy, mock_load_balancer_attributes):
"""Test SpinnakerELB create_elb method"""
elb = SpinnakerELB(app='myapp', env='dev', region='us-east-1')
elb.create_elb()
mock_listener_policy.assert_called_with(mock_elb_json())
@mock.patch.object(SpinnakerELB, 'add_backend_policy')
@mock.patch.object(SpinnakerELB, 'add_listener_policy')
@mock.patch('foremast.elb.create_elb.wait_for_task')
@mock.patch.object(SpinnakerELB, 'make_elb_json', return_value={})
@mock.patch('foremast.elb.create_elb.get_properties')
def test_elb_create_elb(mock_get_properties, mock_elb_json, mock_wait_for_task, mock_listener_policy,
mock_backend_policy, mock_load_balancer_attributes):
"""Test SpinnakerELB create_elb method"""
elb = SpinnakerELB(app='myapp', env='dev', region='us-east-1')
elb.create_elb()
mock_listener_policy.assert_called_with(mock_elb_json())
test_port = 80
test_policy_list = ['policy_name']
json_data = {
'job': [{
'listeners': [
{
'internalPort': test_port,
'backendPolicies': test_policy_list
},
],
}],
}
client = mock_boto3_session.return_value.client.return_value
elb = SpinnakerELB(app='myapp', env='dev', region='us-east-1')
elb.add_backend_policy(json.dumps(json_data))
client.set_load_balancer_policies_for_backend_server.assert_called_with(
LoadBalancerName=test_app, InstancePort=test_port, PolicyNames=test_policy_list)
test_port = 80
test_policy_list = ['policy_name']
json_data = {
'job': [{
'listeners': [
{
'externalPort': test_port,
'listenerPolicies': test_policy_list
},
],
}],
}
client = mock_boto3_session.return_value.client.return_value
elb = SpinnakerELB(app='myapp', env='dev', region='us-east-1')
elb.add_listener_policy(json.dumps(json_data))
client.set_load_balancer_policies_of_listener.assert_called_with(
LoadBalancerName=test_app, LoadBalancerPort=test_port, PolicyNames=test_policy_list)
def create_elb(self):
""" Creates the ELB for the defined environment """
utils.banner("Creating ELB")
elbobj = elb.SpinnakerELB(app=self.app,
env=self.env,
region=self.region,
prop_path=self.json_path)
elbobj.create_elb()
def create_elb(self):
"""Create the ELB for the defined environment."""
utils.banner("Creating ELB")
elbobj = elb.SpinnakerELB(app=self.app, env=self.env, region=self.region, prop_path=self.json_path)
elbobj.create_elb()