Fixing broken tests #2126
- KMS - S3 - CloudFormation (Thanks kgutwin!)
This commit is contained in:
parent
64152f4cda
commit
921b5a3227
@ -85,9 +85,9 @@ class FakeStack(BaseModel):
|
||||
def _parse_template(self):
|
||||
yaml.add_multi_constructor('', yaml_tag_constructor)
|
||||
try:
|
||||
self.template_dict = yaml.load(self.template)
|
||||
self.template_dict = yaml.load(self.template, Loader=yaml.Loader)
|
||||
except yaml.parser.ParserError:
|
||||
self.template_dict = json.loads(self.template)
|
||||
self.template_dict = json.loads(self.template, Loader=yaml.Loader)
|
||||
|
||||
@property
|
||||
def stack_parameters(self):
|
||||
|
@ -448,8 +448,8 @@ def test_short_form_func_in_yaml_teamplate():
|
||||
KeySplit: !Split [A, B]
|
||||
KeySub: !Sub A
|
||||
"""
|
||||
yaml.add_multi_constructor('', yaml_tag_constructor)
|
||||
template_dict = yaml.load(template)
|
||||
yaml.add_multi_constructor('', yaml_tag_constructor, Loader=yaml.Loader)
|
||||
template_dict = yaml.load(template, Loader=yaml.Loader)
|
||||
key_and_expects = [
|
||||
['KeyRef', {'Ref': 'foo'}],
|
||||
['KeyB64', {'Fn::Base64': 'valueToEncode'}],
|
||||
|
@ -8,8 +8,8 @@ import sure # noqa
|
||||
from moto import mock_kms, mock_kms_deprecated
|
||||
from nose.tools import assert_raises
|
||||
from freezegun import freeze_time
|
||||
from datetime import datetime, timedelta
|
||||
from dateutil.tz import tzlocal
|
||||
from datetime import datetime
|
||||
from dateutil.tz import tzutc
|
||||
|
||||
|
||||
@mock_kms_deprecated
|
||||
@ -660,7 +660,7 @@ def test_schedule_key_deletion():
|
||||
KeyId=key['KeyMetadata']['KeyId']
|
||||
)
|
||||
assert response['KeyId'] == key['KeyMetadata']['KeyId']
|
||||
assert response['DeletionDate'] == datetime(2015, 1, 31, 12, 0, tzinfo=tzlocal())
|
||||
assert response['DeletionDate'] == datetime(2015, 1, 31, 12, 0, tzinfo=tzutc())
|
||||
else:
|
||||
# Can't manipulate time in server mode
|
||||
response = client.schedule_key_deletion(
|
||||
@ -685,7 +685,7 @@ def test_schedule_key_deletion_custom():
|
||||
PendingWindowInDays=7
|
||||
)
|
||||
assert response['KeyId'] == key['KeyMetadata']['KeyId']
|
||||
assert response['DeletionDate'] == datetime(2015, 1, 8, 12, 0, tzinfo=tzlocal())
|
||||
assert response['DeletionDate'] == datetime(2015, 1, 8, 12, 0, tzinfo=tzutc())
|
||||
else:
|
||||
# Can't manipulate time in server mode
|
||||
response = client.schedule_key_deletion(
|
||||
|
@ -15,6 +15,7 @@ class AuthenticatedClient(FlaskClient):
|
||||
def open(self, *args, **kwargs):
|
||||
kwargs['headers'] = kwargs.get('headers', {})
|
||||
kwargs['headers']['Authorization'] = "Any authorization header"
|
||||
kwargs['content_length'] = 0 # Fixes content-length complaints.
|
||||
return super(AuthenticatedClient, self).open(*args, **kwargs)
|
||||
|
||||
|
||||
|
@ -13,6 +13,7 @@ class AuthenticatedClient(FlaskClient):
|
||||
def open(self, *args, **kwargs):
|
||||
kwargs['headers'] = kwargs.get('headers', {})
|
||||
kwargs['headers']['Authorization'] = "Any authorization header"
|
||||
kwargs['content_length'] = 0 # Fixes content-length complaints.
|
||||
return super(AuthenticatedClient, self).open(*args, **kwargs)
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user