Fix tests for py3.
This commit is contained in:
parent
0dda687762
commit
3c0c4c2996
10 changed files with 16 additions and 20 deletions
|
|
@ -4,12 +4,12 @@ import json
|
|||
from mock import patch
|
||||
import sure # noqa
|
||||
|
||||
from moto.cloudformation.exceptions import ValidationError
|
||||
from moto.cloudformation.models import FakeStack
|
||||
from moto.cloudformation.parsing import resource_class_from_type, parse_condition
|
||||
from moto.sqs.models import Queue
|
||||
from moto.s3.models import FakeBucket
|
||||
from boto.cloudformation.stack import Output
|
||||
from boto.exception import BotoServerError
|
||||
|
||||
dummy_template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
|
@ -158,7 +158,7 @@ def test_parse_stack_with_get_attribute_outputs():
|
|||
|
||||
def test_parse_stack_with_bad_get_attribute_outputs():
|
||||
FakeStack.when.called_with(
|
||||
"test_id", "test_stack", bad_output_template_json, {}, "us-west-1").should.throw(BotoServerError)
|
||||
"test_id", "test_stack", bad_output_template_json, {}, "us-west-1").should.throw(ValidationError)
|
||||
|
||||
|
||||
def test_parse_equals_condition():
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ def test_request_spot_instances():
|
|||
"ImageId": 'ami-abcd1234',
|
||||
"KeyName": "test",
|
||||
"SecurityGroups": ['group1', 'group2'],
|
||||
"UserData": b"some test data",
|
||||
"UserData": "some test data",
|
||||
"InstanceType": 'm1.small',
|
||||
"Placement": {
|
||||
"AvailabilityZone": 'us-east-1c',
|
||||
|
|
@ -67,7 +67,7 @@ def test_request_spot_instances():
|
|||
"ImageId": 'ami-abcd1234',
|
||||
"KeyName": "test",
|
||||
"SecurityGroups": ['group1', 'group2'],
|
||||
"UserData": b"some test data",
|
||||
"UserData": "some test data",
|
||||
"InstanceType": 'm1.small',
|
||||
"Placement": {
|
||||
"AvailabilityZone": 'us-east-1c',
|
||||
|
|
|
|||
|
|
@ -347,8 +347,7 @@ def test_run_job_flow_with_invalid_params():
|
|||
args['AmiVersion'] = '2.4'
|
||||
args['ReleaseLabel'] = 'emr-5.0.0'
|
||||
client.run_job_flow(**args)
|
||||
ex.exception.response['Error'][
|
||||
'Message'].should.contain('ValidationException')
|
||||
ex.exception.response['Error']['Code'].should.equal('ValidationException')
|
||||
|
||||
|
||||
@mock_emr
|
||||
|
|
|
|||
|
|
@ -49,7 +49,6 @@ def get_random_rule():
|
|||
return RULES[random.randint(0, len(RULES) - 1)]
|
||||
|
||||
|
||||
@mock_events
|
||||
def generate_environment():
|
||||
client = boto3.client('events', 'us-west-2')
|
||||
|
||||
|
|
@ -115,12 +114,12 @@ def test_list_rule_names_by_target():
|
|||
client = generate_environment()
|
||||
|
||||
rules = client.list_rule_names_by_target(TargetArn=test_1_target['Arn'])
|
||||
assert(len(rules) == len(test_1_target['Rules']))
|
||||
assert(len(rules['RuleNames']) == len(test_1_target['Rules']))
|
||||
for rule in rules['RuleNames']:
|
||||
assert(rule in test_1_target['Rules'])
|
||||
|
||||
rules = client.list_rule_names_by_target(TargetArn=test_2_target['Arn'])
|
||||
assert(len(rules) == len(test_2_target['Rules']))
|
||||
assert(len(rules['RuleNames']) == len(test_2_target['Rules']))
|
||||
for rule in rules['RuleNames']:
|
||||
assert(rule in test_2_target['Rules'])
|
||||
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ def test_my_model_save():
|
|||
body = conn.Object('mybucket', 'steve').get()[
|
||||
'Body'].read().decode("utf-8")
|
||||
|
||||
assert body == b'is awesome'
|
||||
assert body == 'is awesome'
|
||||
|
||||
|
||||
@mock_s3
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue