Techdebt: Move some tests around (#6617)

This commit is contained in:
Bert Blommers 2023-08-08 14:38:09 +00:00 committed by GitHub
parent 2b0d6ee0dc
commit 9636e02127
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 37 deletions

View File

@ -1,13 +1,15 @@
"""Unit tests specific to VPC endpoint services."""
import boto3
import pytest
import boto3
from botocore.exceptions import ClientError
from moto import mock_ec2, settings
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
from unittest import SkipTest
from moto import mock_ec2, mock_elbv2, settings
from moto.core import DEFAULT_ACCOUNT_ID as ACCOUNT_ID
from .test_vpc_service_configuration import create_load_balancer
@mock_ec2
def test_describe_vpc_endpoint_services_bad_args():
@ -263,3 +265,35 @@ def test_describe_vpc_default_endpoint_services():
assert details["ServiceName"] == "com.amazonaws.us-west-1.config"
assert details["ServiceType"] == [{"ServiceType": "Interface"}]
assert details["VpcEndpointPolicySupported"] is True
@mock_ec2
@mock_elbv2
def test_create_vpc_endpoint_service_configuration_with_options():
client = boto3.client("ec2", region_name="us-east-2")
lb_arn = create_load_balancer(
region_name="us-east-2", lb_type="gateway", zone="us-east-1c"
)
config = client.create_vpc_endpoint_service_configuration(
GatewayLoadBalancerArns=[lb_arn],
AcceptanceRequired=False,
PrivateDnsName="example.com",
)["ServiceConfiguration"]
assert config["AcceptanceRequired"] is False
assert config["PrivateDnsName"] == "example.com"
assert config["PrivateDnsNameConfiguration"] == {
"Name": "n",
"State": "verified",
"Type": "TXT",
"Value": "val",
}
service_name = config["ServiceName"]
detail = client.describe_vpc_endpoint_services(ServiceNames=[service_name])[
"ServiceDetails"
][0]
assert detail["ServiceName"] == service_name
assert detail["Owner"] == ACCOUNT_ID

View File

@ -3,7 +3,6 @@ import pytest
from botocore.exceptions import ClientError
from moto import mock_ec2, mock_elbv2
from moto.core import DEFAULT_ACCOUNT_ID
from moto.moto_api._internal import mock_random
# See our Development Tips on writing tests for hints on how to write good tests:
@ -93,38 +92,6 @@ def test_create_vpc_endpoint_service_configuration_with_gateway_load_balancer():
assert "NetworkLoadBalancerArns" not in config
@mock_ec2
@mock_elbv2
def test_create_vpc_endpoint_service_configuration_with_options():
client = boto3.client("ec2", region_name="us-east-2")
lb_arn = create_load_balancer(
region_name="us-east-2", lb_type="gateway", zone="us-east-1c"
)
config = client.create_vpc_endpoint_service_configuration(
GatewayLoadBalancerArns=[lb_arn],
AcceptanceRequired=False,
PrivateDnsName="example.com",
)["ServiceConfiguration"]
assert config["AcceptanceRequired"] is False
assert config["PrivateDnsName"] == "example.com"
assert config["PrivateDnsNameConfiguration"] == {
"Name": "n",
"State": "verified",
"Type": "TXT",
"Value": "val",
}
service_name = config["ServiceName"]
detail = client.describe_vpc_endpoint_services(ServiceNames=[service_name])[
"ServiceDetails"
][0]
assert detail["ServiceName"] == service_name
assert detail["Owner"] == DEFAULT_ACCOUNT_ID
@mock_ec2
@mock_elbv2
def test_describe_vpc_endpoint_service_configurations():