diff --git a/boto/ec2/networkinterface.py b/boto/ec2/networkinterface.py index 7195b12231..fca93d4cdf 100644 --- a/boto/ec2/networkinterface.py +++ b/boto/ec2/networkinterface.py @@ -60,7 +60,7 @@ def endElement(self, name, value, connection): elif name == 'instanceId': self.instance_id = value elif name == 'deviceIndex': - self.device_index = value + self.device_index = int(value) elif name == 'instanceOwnerId': self.instance_owner_id = value elif name == 'status': diff --git a/tests/unit/ec2/test_connection.py b/tests/unit/ec2/test_connection.py index d06288dc56..a1e1412873 100644 --- a/tests/unit/ec2/test_connection.py +++ b/tests/unit/ec2/test_connection.py @@ -562,5 +562,63 @@ def test_describe_vpc_attribute(self): 'Version']) +class TestGetAllNetworkInterfaces(TestEC2ConnectionBase): + def default_body(self): + return """ + fc45294c-006b-457b-bab9-012f5b3b0e40 + + + eni-0f62d866 + subnet-c53c87ac + vpc-cc3c87a5 + ap-southeast-1b + + 053230519467 + false + in-use + 02:81:60:cb:27:37 + 10.0.0.146 + true + + + sg-3f4b5653 + default + + + + eni-attach-6537fc0c + i-22197876 + 053230519467 + 5 + attached + 2012-07-01T21:45:27.000Z + true + + + + + 10.0.0.146 + true + + + 10.0.0.148 + false + + + 10.0.0.150 + false + + + + +""" + + def test_attachment_has_device_index(self): + self.set_http_response(status_code=200) + parsed = self.ec2.get_all_network_interfaces() + + self.assertEqual(5, parsed[0].attachment.device_index) + + if __name__ == '__main__': unittest.main()