@mock_ec2_deprecated
def test_add_tag():
    conn = boto.connect_ec2('the_key', 'the_secret')
    reservation = conn.run_instances(EXAMPLE_AMI_ID)
    instance = reservation.instances[0]
    with pytest.raises(EC2ResponseError) as ex:
        instance.add_tag('a key', 'some value', dry_run=True)
    ex.value.error_code.should.equal('DryRunOperation')
    ex.value.status.should.equal(400)
    ex.value.message.should.equal('An error occurred (DryRunOperation) when calling the CreateTags operation: Request would have succeeded, but DryRun flag is set')
    instance.add_tag('a key', 'some value')
    chain = itertools.chain.from_iterable
    existing_instances = list(chain([res.instances for res in conn.get_all_reservations()]))
    existing_instances.should.have.length_of(1)
    existing_instance = existing_instances[0]
    existing_instance.tags['a key'].should.equal('some value')
@mock_ec2_deprecated
def test_add_tag():
    conn = boto.connect_ec2('the_key', 'the_secret')
    reservation = conn.run_instances(EXAMPLE_AMI_ID)
    instance = reservation.instances[0]
    with pytest.raises(EC2ResponseError) as ex:
        instance.add_tag('a key', 'some value', dry_run=True)
    ex.value.error_code.should.equal('DryRunOperation')
    ex.value.status.should.equal(400)
    ex.value.message.should.equal('An error occurred (DryRunOperation) when calling the CreateTags operation: Request would have succeeded, but DryRun flag is set')
    instance.add_tag('a key', 'some value')
    chain = itertools.chain.from_iterable
    existing_instances = list(chain([res.instances for res in conn.get_all_reservations()]))
    existing_instances.should.have.length_of(1)
    existing_instance = existing_instances[0]
    existing_instance.tags['a key'].should.equal('some value')