Tech debt (#3653)
This commit is contained in:
parent
81859f9180
commit
737636f9df
@ -699,28 +699,7 @@ class CognitoIdpBackend(BaseBackend):
|
|||||||
if not client:
|
if not client:
|
||||||
raise ResourceNotFoundError(client_id)
|
raise ResourceNotFoundError(client_id)
|
||||||
|
|
||||||
if auth_flow == "ADMIN_NO_SRP_AUTH":
|
if auth_flow in ("ADMIN_USER_PASSWORD_AUTH", "ADMIN_NO_SRP_AUTH"):
|
||||||
username = auth_parameters.get("USERNAME")
|
|
||||||
password = auth_parameters.get("PASSWORD")
|
|
||||||
user = user_pool.users.get(username)
|
|
||||||
if not user:
|
|
||||||
raise UserNotFoundError(username)
|
|
||||||
|
|
||||||
if user.password != password:
|
|
||||||
raise NotAuthorizedError(username)
|
|
||||||
|
|
||||||
if user.status == UserStatus["FORCE_CHANGE_PASSWORD"]:
|
|
||||||
session = str(uuid.uuid4())
|
|
||||||
self.sessions[session] = user_pool
|
|
||||||
|
|
||||||
return {
|
|
||||||
"ChallengeName": "NEW_PASSWORD_REQUIRED",
|
|
||||||
"ChallengeParameters": {},
|
|
||||||
"Session": session,
|
|
||||||
}
|
|
||||||
|
|
||||||
return self._log_user_in(user_pool, client, username)
|
|
||||||
elif auth_flow == "ADMIN_USER_PASSWORD_AUTH":
|
|
||||||
username = auth_parameters.get("USERNAME")
|
username = auth_parameters.get("USERNAME")
|
||||||
password = auth_parameters.get("PASSWORD")
|
password = auth_parameters.get("PASSWORD")
|
||||||
user = user_pool.users.get(username)
|
user = user_pool.users.get(username)
|
||||||
|
@ -580,9 +580,7 @@ class SageMakerModelBackend(BaseBackend):
|
|||||||
message = "Could not find model '{}'.".format(
|
message = "Could not find model '{}'.".format(
|
||||||
Model.arn_for_model_name(model_name, self.region_name)
|
Model.arn_for_model_name(model_name, self.region_name)
|
||||||
)
|
)
|
||||||
raise RESTError(
|
raise ValidationError(message=message)
|
||||||
error_type="ValidationException", message=message, template="error_json",
|
|
||||||
)
|
|
||||||
|
|
||||||
def list_models(self):
|
def list_models(self):
|
||||||
models = []
|
models = []
|
||||||
|
@ -387,22 +387,6 @@ def test_duplicate_put_metric_data():
|
|||||||
Namespace="tester", Dimensions=[{"Name": "Name", "Value": "B"}]
|
Namespace="tester", Dimensions=[{"Name": "Name", "Value": "B"}]
|
||||||
)["Metrics"]
|
)["Metrics"]
|
||||||
len(result).should.equal(1)
|
len(result).should.equal(1)
|
||||||
|
|
||||||
conn.put_metric_data(
|
|
||||||
Namespace="tester",
|
|
||||||
MetricData=[
|
|
||||||
dict(
|
|
||||||
MetricName="metric",
|
|
||||||
Dimensions=[{"Name": "Name", "Value": "B"}],
|
|
||||||
Value=1.5,
|
|
||||||
Timestamp=utc_now,
|
|
||||||
)
|
|
||||||
],
|
|
||||||
)
|
|
||||||
|
|
||||||
result = conn.list_metrics(
|
|
||||||
Namespace="tester", Dimensions=[{"Name": "Name", "Value": "B"}]
|
|
||||||
)["Metrics"]
|
|
||||||
result.should.equal(
|
result.should.equal(
|
||||||
[
|
[
|
||||||
{
|
{
|
||||||
|
@ -6,7 +6,6 @@ import boto3
|
|||||||
from boto.exception import EC2ResponseError
|
from boto.exception import EC2ResponseError
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
import sure # noqa
|
import sure # noqa
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
|
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
|||||||
import boto
|
import boto
|
||||||
import boto3
|
import boto3
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
import sure # noqa
|
import sure # noqa
|
||||||
from boto.exception import EC2ResponseError
|
from boto.exception import EC2ResponseError
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import time
|
import time
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import re
|
import re
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto
|
import boto
|
||||||
|
@ -3,7 +3,6 @@ from __future__ import unicode_literals
|
|||||||
import copy
|
import copy
|
||||||
import json
|
import json
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
import boto3
|
import boto3
|
||||||
|
@ -6,7 +6,6 @@ import boto
|
|||||||
import boto3
|
import boto3
|
||||||
import boto.vpc
|
import boto.vpc
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
import sure # noqa
|
import sure # noqa
|
||||||
from boto.exception import EC2ResponseError
|
from boto.exception import EC2ResponseError
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
from moto.ec2.exceptions import EC2ClientError
|
from moto.ec2.exceptions import EC2ClientError
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
# Ensure 'pytest.raises' context manager support for Python 2.6
|
|
||||||
import pytest
|
import pytest
|
||||||
from moto.ec2.exceptions import EC2ClientError
|
from moto.ec2.exceptions import EC2ClientError
|
||||||
from botocore.exceptions import ClientError
|
from botocore.exceptions import ClientError
|
||||||
|
@ -45,6 +45,14 @@ def test_describe_model():
|
|||||||
assert model.get("ModelName").should.equal("blah")
|
assert model.get("ModelName").should.equal("blah")
|
||||||
|
|
||||||
|
|
||||||
|
@mock_sagemaker
|
||||||
|
def test_describe_model_not_found():
|
||||||
|
client = boto3.client("sagemaker", region_name="us-east-1")
|
||||||
|
with pytest.raises(ClientError) as err:
|
||||||
|
client.describe_model(ModelName="unknown")
|
||||||
|
assert err.value.response["Error"]["Message"].should.contain("Could not find model")
|
||||||
|
|
||||||
|
|
||||||
@mock_sagemaker
|
@mock_sagemaker
|
||||||
def test_create_model():
|
def test_create_model():
|
||||||
client = boto3.client("sagemaker", region_name="us-east-1")
|
client = boto3.client("sagemaker", region_name="us-east-1")
|
||||||
|
@ -2349,7 +2349,7 @@ def test_fifo_queue_deduplication_withoutid(msg_1, msg_2, expected_count):
|
|||||||
@mock_sqs
|
@mock_sqs
|
||||||
def test_fifo_queue_send_duplicate_messages_after_deduplication_time_limit():
|
def test_fifo_queue_send_duplicate_messages_after_deduplication_time_limit():
|
||||||
if settings.TEST_SERVER_MODE:
|
if settings.TEST_SERVER_MODE:
|
||||||
raise SkipTest("Cant manipulate time in server mode")
|
raise SkipTest("Cant patch env variables in server mode")
|
||||||
|
|
||||||
sqs = boto3.resource("sqs", region_name="us-east-1")
|
sqs = boto3.resource("sqs", region_name="us-east-1")
|
||||||
msg_queue = sqs.create_queue(
|
msg_queue = sqs.create_queue(
|
||||||
|
Loading…
Reference in New Issue
Block a user