def test_find_unique_vi_returns_multiple(placeboify, maybe_sleep): client = placeboify.client("directconnect") module = FakeModule(state="present", id_to_associate="dxcon-aaaaaaaa", public=False, name=None) try: aws_direct_connect_virtual_interface.ensure_state(client, module) except Exception: assert "Multiple virtual interfaces were found" in module.exit_kwargs[ "msg"]
def test_find_unique_vi_returns_missing_for_vi_id(placeboify, maybe_sleep): client = placeboify.client("directconnect") module = FakeModule(state="present", id_to_associate=None, public=False, name=None, virtual_interface_id="dxvif-aaaaaaaa") try: aws_direct_connect_virtual_interface.ensure_state(client, module) except Exception: assert "The virtual interface dxvif-aaaaaaaa does not exist" in module.exit_kwargs[ "msg"]
def test_delete_vi(placeboify, maybe_sleep): client = placeboify.client("directconnect") module = FakeModule(state="absent", id_to_associate='dxcon-aaaaaaaa', virtual_interface_id='dxvif-aaaaaaaa', public=False, name="aaaaaaaa", vlan=1, bgp_asn=123, authentication_key="aaaa", customer_address="169.254.0.1/30", amazon_address="169.254.0.2/30", address_type="ipv4", cidr=["10.88.0.0/30"], virtual_gateway_id=None, direct_connect_gateway_id="yyyy") changed, latest_state = aws_direct_connect_virtual_interface.ensure_state(client, module) assert changed is True assert latest_state == {}