Merge pull request #351 from kpdonn/master

Fix bug creating elb with a listener certificate
This commit is contained in:
Steve Pulec 2015-05-20 21:58:31 -04:00
commit 55f36a3a43
2 changed files with 19 additions and 1 deletions

View File

@ -31,7 +31,7 @@ class ELBResponse(BaseResponse):
break
lb_port = self.querystring['Listeners.member.{0}.LoadBalancerPort'.format(port_index)][0]
instance_port = self.querystring['Listeners.member.{0}.InstancePort'.format(port_index)][0]
ssl_certificate_id = self.querystring.get('Listeners.member.{0}.SSLCertificateId'.format(port_index)[0], None)
ssl_certificate_id = self.querystring.get('Listeners.member.{0}.SSLCertificateId'.format(port_index), [None])[0]
ports.append([protocol, lb_port, instance_port, ssl_certificate_id])
port_index += 1

View File

@ -48,6 +48,24 @@ def test_create_elb_in_multiple_region():
list(west1_conn.get_all_load_balancers()).should.have.length_of(1)
list(west2_conn.get_all_load_balancers()).should.have.length_of(1)
@mock_elb
def test_create_load_balancer_with_certificate():
conn = boto.connect_elb()
zones = ['us-east-1a']
ports = [(443, 8443, 'https', 'arn:aws:iam:123456789012:server-certificate/test-cert')]
conn.create_load_balancer('my-lb', zones, ports)
balancers = conn.get_all_load_balancers()
balancer = balancers[0]
balancer.name.should.equal("my-lb")
set(balancer.availability_zones).should.equal(set(['us-east-1a']))
listener = balancer.listeners[0]
listener.load_balancer_port.should.equal(443)
listener.instance_port.should.equal(8443)
listener.protocol.should.equal("HTTPS")
listener.ssl_certificate_id.should.equal('arn:aws:iam:123456789012:server-certificate/test-cert')
@mock_elb
def test_add_listener():