Port test suite from nose to pytest.
This just eliminates all errors on the tests collection. Elimination of failures is left to the next commit.
This commit is contained in:
parent
47dbad291e
commit
77dc60ea97
146 changed files with 1172 additions and 1277 deletions
|
|
@ -4,7 +4,7 @@ from moto import mock_applicationautoscaling, mock_ecs
|
|||
from moto.applicationautoscaling import models
|
||||
from moto.applicationautoscaling.exceptions import AWSValidationException
|
||||
from botocore.exceptions import ParamValidationError
|
||||
from nose.tools import assert_raises
|
||||
import pytest
|
||||
import sure # noqa
|
||||
from botocore.exceptions import ClientError
|
||||
from parameterized import parameterized
|
||||
|
|
@ -25,21 +25,21 @@ DEFAULT_ROLE_ARN = "test:arn"
|
|||
@mock_applicationautoscaling
|
||||
def test_describe_scalable_targets_no_params_should_raise_param_validation_errors():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
with assert_raises(ParamValidationError):
|
||||
with pytest.raises(ParamValidationError):
|
||||
client.describe_scalable_targets()
|
||||
|
||||
|
||||
@mock_applicationautoscaling
|
||||
def test_register_scalable_target_no_params_should_raise_param_validation_errors():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
with assert_raises(ParamValidationError):
|
||||
with pytest.raises(ParamValidationError):
|
||||
client.register_scalable_target()
|
||||
|
||||
|
||||
@mock_applicationautoscaling
|
||||
def test_register_scalable_target_with_none_service_namespace_should_raise_param_validation_errors():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
with assert_raises(ParamValidationError):
|
||||
with pytest.raises(ParamValidationError):
|
||||
register_scalable_target(client, ServiceNamespace=None)
|
||||
|
||||
|
||||
|
|
@ -47,7 +47,7 @@ def test_register_scalable_target_with_none_service_namespace_should_raise_param
|
|||
def test_describe_scalable_targets_with_invalid_scalable_dimension_should_return_validation_exception():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
|
||||
with assert_raises(ClientError) as err:
|
||||
with pytest.raises(ClientError) as err:
|
||||
response = client.describe_scalable_targets(
|
||||
ServiceNamespace=DEFAULT_SERVICE_NAMESPACE, ScalableDimension="foo",
|
||||
)
|
||||
|
|
@ -62,7 +62,7 @@ def test_describe_scalable_targets_with_invalid_scalable_dimension_should_return
|
|||
def test_describe_scalable_targets_with_invalid_service_namespace_should_return_validation_exception():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
|
||||
with assert_raises(ClientError) as err:
|
||||
with pytest.raises(ClientError) as err:
|
||||
response = client.describe_scalable_targets(
|
||||
ServiceNamespace="foo", ScalableDimension=DEFAULT_SCALABLE_DIMENSION,
|
||||
)
|
||||
|
|
@ -77,7 +77,7 @@ def test_describe_scalable_targets_with_invalid_service_namespace_should_return_
|
|||
def test_describe_scalable_targets_with_multiple_invalid_parameters_should_return_validation_exception():
|
||||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
|
||||
with assert_raises(ClientError) as err:
|
||||
with pytest.raises(ClientError) as err:
|
||||
response = client.describe_scalable_targets(
|
||||
ServiceNamespace="foo", ScalableDimension="bar",
|
||||
)
|
||||
|
|
@ -94,7 +94,7 @@ def test_register_scalable_target_ecs_with_non_existent_service_should_return_va
|
|||
client = boto3.client("application-autoscaling", region_name=DEFAULT_REGION)
|
||||
resource_id = "service/{}/foo".format(DEFAULT_ECS_CLUSTER)
|
||||
|
||||
with assert_raises(ClientError) as err:
|
||||
with pytest.raises(ClientError) as err:
|
||||
register_scalable_target(client, ServiceNamespace="ecs", ResourceId=resource_id)
|
||||
err.response["Error"]["Code"].should.equal("ValidationException")
|
||||
err.response["Error"]["Message"].should.equal(
|
||||
|
|
@ -116,7 +116,7 @@ def test_target_params_are_valid_success(namespace, r_id, dimension, expected):
|
|||
expected
|
||||
)
|
||||
else:
|
||||
with assert_raises(AWSValidationException):
|
||||
with pytest.raises(AWSValidationException):
|
||||
models._target_params_are_valid(namespace, r_id, dimension)
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue