<commit_before># -*- encoding: utf-8 -*-

import pytest
from awscfncli.config import load_stack_config

__author__ = 'ray'
__date__ = '1/9/17'


def test_load_stack_config(tmpdir):
    mock_config = \
        """
        Stack:
          StackName:            ExampleStack
          Region:               ap-northeast-1
          TemplateURL:          http://s3.amazonaws.com/example/example.template
          Parameters:
            ParameterKey1:      ParameterValue1
            ParameterKey2:      ParameterValue2
          Tags:
            TagKey1:            TagValue1
            TagKey2:            TagValue2
        """

    path = tmpdir.join('config.yml')
    path.write(mock_config)

    expected_value = {
        'StackName': 'ExampleStack',
        'Region': 'ap-northeast-1',
        'TemplateURL': 'http://s3.amazonaws.com/example/example.template',
        'Parameters': [
            {
                'ParameterKey': 'ParameterKey1',
                'ParameterValue': 'ParameterValue1',
            },
            {
                'ParameterKey': 'ParameterKey2',
                'ParameterValue': 'ParameterValue2',
            }
        ],
        'Tags': [
            {<commit_msg>Add test for different parameter type<commit_after># -*- encoding: utf-8 -*-

import pytest
from awscfncli.config import load_stack_config

__author__ = 'ray'
__date__ = '1/9/17'


def test_load_stack_config(tmpdir):
    mock_config = \
        """
        Stack:
          StackName:            ExampleStack
          Region:               ap-northeast-1
          TemplateURL:          http://s3.amazonaws.com/example/example.template
          DisableRollback:      True
          TimeoutInMinutes:     10
          Parameters:
            ParameterKey1:      ParameterValue1
            ParameterKey2:      True
            ParameterKey3:      10
          Tags:
            TagKey1:            TagValue1
            TagKey2:            TagValue2
        """

    path = tmpdir.join('config.yml')
    path.write(mock_config)

    expected_value = {
        'StackName': 'ExampleStack',
        'Region': 'ap-northeast-1',
        'TemplateURL': 'http://s3.amazonaws.com/example/example.template',
        'DisableRollback': True,
        'TimeoutInMinutes': 10,
        'Parameters': [
            {
                'ParameterKey': 'ParameterKey1',
                'ParameterValue': 'ParameterValue1',
            },
            {
                'ParameterKey': 'ParameterKey2',
                'ParameterValue': 'true',
            },
            {
                'ParameterKey': 'ParameterKey3',
                'ParameterValue': '10',
            }
        ],
        'Tags': [
            {
{'fraction_non_alphanumeric': 0.10709010339734121, 'fraction_numerical': 0.01846381093057607, 'mean_word_length': 1.4493670886075949, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1509150', 'n_tokens_mistral': 751, 'n_tokens_neox': 727, 'n_words': 125}