Skip to content

Commit

Permalink
Merge pull request #1760 from martinthegeek/develop
Browse files Browse the repository at this point in the history
fix typo in detach_subnets(). Fixes #1760.
  • Loading branch information
danielgtaylor committed Oct 7, 2013
2 parents bec5e70 + 8664c7a commit 4424e1b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion boto/ec2/elb/loadbalancer.py
Expand Up @@ -342,7 +342,7 @@ def detach_subnets(self, subnets):
"""
if isinstance(subnets, str) or isinstance(subnets, unicode):
subnets = [subnets]
new_subnets = self.connection.detach_lb_to_subnets(self.name, subnets)
new_subnets = self.connection.detach_lb_from_subnets(self.name, subnets)
self.subnets = new_subnets

def apply_security_groups(self, security_groups):
Expand Down
19 changes: 19 additions & 0 deletions tests/unit/ec2/elb/test_loadbalancer.py
Expand Up @@ -6,6 +6,7 @@
import mock

from boto.ec2.elb import ELBConnection
from boto.ec2.elb import LoadBalancer

DISABLE_RESPONSE = r"""<?xml version="1.0" encoding="UTF-8"?>
<DisableAvailabilityZonesForLoadBalancerResult xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
Expand Down Expand Up @@ -107,5 +108,23 @@ def test_other_policy(self):
self.assertEqual(lb.backends[0].instance_port, 80)


DETACH_RESPONSE = r"""<?xml version="1.0" encoding="UTF-8"?>
<DetachLoadBalancerFromSubnets xmlns="http://ec2.amazonaws.com/doc/2013-02-01/">
<requestId>3be1508e-c444-4fef-89cc-0b1223c4f02fEXAMPLE</requestId>
</DetachLoadBalancerFromSubnets>
"""

class TestDetachSubnets(unittest.TestCase):
def test_detach_subnets(self):
elb = ELBConnection(aws_access_key_id='aws_access_key_id',
aws_secret_access_key='aws_secret_access_key')
lb = LoadBalancer(elb, "mylb")

mock_response = mock.Mock()
mock_response.read.return_value = DETACH_RESPONSE
mock_response.status = 200
elb.make_request = mock.Mock(return_value=mock_response)
lb.detach_subnets("s-xxx")

if __name__ == '__main__':
unittest.main()

0 comments on commit 4424e1b

Please sign in to comment.