From 20e00dd0954ed332ba53cfb37227f12450258b51 Mon Sep 17 00:00:00 2001 From: Kieran Doonan Date: Tue, 5 Jul 2016 11:20:28 +0100 Subject: [PATCH] added tests for broken tag filter --- tests/test_ec2/test_tags.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_ec2/test_tags.py b/tests/test_ec2/test_tags.py index d8b585842..adf2a697b 100644 --- a/tests/test_ec2/test_tags.py +++ b/tests/test_ec2/test_tags.py @@ -345,3 +345,17 @@ def test_retrieved_snapshots_must_contain_their_tags(): # Check whether tag is present with correct value retrieved_tags[tag_key].should.equal(tag_value) + + +@mock_ec2 +def test_filter_instances_by_tags(): + conn = boto.connect_ec2(aws_access_key_id='the_key', aws_secret_access_key='the_secret') + reservation = conn.run_instances('ami-1234abcd') + instance_a = reservation.instances[0] + instance_a.add_tag("Key1", "Value1") + reservation_b = conn.run_instances('ami-1234abcd') + instance_b = reservation_b.instances[0] + instance_b.add_tag("Key1", "Value2") + + reservations = conn.get_all_instances(filters={'tag:Key1': 'Value*'}) + reservations.should.have.length_of(2)