Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions tests/translator/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
from mock import Mock, MagicMock, patch


input_folder = 'tests/translator/input'
output_folder = 'tests/translator/output'
BASE_PATH = os.path.dirname(__file__)
INPUT_FOLDER = os.path.join(BASE_PATH, 'input')
OUTPUT_FOLDER = os.path.join(BASE_PATH, 'output')


def deep_sort_lists(value):
Expand Down Expand Up @@ -168,11 +169,11 @@ def test_transform_success(self, testcase, partition_with_region):
partition = partition_with_region[0]
region = partition_with_region[1]

manifest = yaml_parse(open(os.path.join(input_folder, testcase + '.yaml'), 'r'))
manifest = yaml_parse(open(os.path.join(INPUT_FOLDER, testcase + '.yaml'), 'r'))
# To uncover unicode-related bugs, convert dict to JSON string and parse JSON back to dict
manifest = json.loads(json.dumps(manifest))
partition_folder = partition if partition != "aws" else ""
expected = json.load(open(os.path.join(output_folder,partition_folder, testcase + '.json'), 'r'))
expected = json.load(open(os.path.join(OUTPUT_FOLDER,partition_folder, testcase + '.json'), 'r'))

old_region = os.environ.get("AWS_DEFAULT_REGION", "")
os.environ["AWS_DEFAULT_REGION"] = region
Expand Down Expand Up @@ -307,8 +308,8 @@ def _generate_new_deployment_hash(self, logical_id, dict_to_hash, rest_api_to_sw
'error_function_with_invalid_policy_statement'
])
def test_transform_invalid_document(testcase):
manifest = yaml.load(open(os.path.join(input_folder, testcase + '.yaml'), 'r'))
expected = json.load(open(os.path.join(output_folder, testcase + '.json'), 'r'))
manifest = yaml.load(open(os.path.join(INPUT_FOLDER, testcase + '.yaml'), 'r'))
expected = json.load(open(os.path.join(OUTPUT_FOLDER, testcase + '.json'), 'r'))

mock_policy_loader = MagicMock()
parameter_values = get_template_parameter_values()
Expand Down