def test_will_parse_AWS_node_environment_configuration(self):
        single_service_yaml = """
            prod:
                services:
                    hello_world: [ web_node, web_node ]
                    mongo: [ db_node ]

                node_provider:
                    class_name: AWSNodeProvider
                    public_api_key: AKIAIGBFGAGVPGKLVX4Q
                    private_api_key: NAOcwcX3an5hcyLCz3Y4xucwr4Fqxs9ijLn6biqk
            """

        aws_node_provider = AWSNodeProvider()
        error_list = []
        aws_node_provider.validate('prod', yaml.load(single_service_yaml)['prod']['node_provider'], error_list, all_credentials)
        self.assertEqual(len(error_list), 0)
    def test_should_add_error_if_public_api_key_is_empty(self):
        single_service_yaml = """
                prod:
                  nodes:
                    - ami_id: ami-4dad7424
                      size:   t1.micro
                      credentials_name: test
                      services: [mongo, hello_world]
                      type: phoenix.providers.aws_provider.AWSNodeDefinition

                  node_provider:
                    class_name: AWSNodeProvider
                    public_api_key:
                    private_api_key: NAOcwcX3an5hcyLCz3Y4xucwr4Fqxs9ijLn6biqk
            """
        aws_node_provider = AWSNodeProvider()
        error_list = []
        aws_node_provider.validate('prod', yaml.load(single_service_yaml)['prod']['node_provider'], error_list, all_credentials)
        self.assertEqual(len(error_list), 1)
        self.assertEqual("Key 'public_api_key' not defined for AWS in 'prod' environment", error_list[0])
    def test_should_add_error_if_private_api_key_contains_only_spaces(self):
        single_service_yaml = """
                prod:
                  nodes:
                    - ami_id: ami-4dad7424
                      size:   t1.micro
                      credentials_name: test
                      services: [mongo, hello_world]
                      type: phoenix.providers.aws_provider.AWSNodeDefinition

                  node_provider:
                    class_name: AWSNodeProvider
                    public_api_key: AKIAIGBFGAGVPGKLVX4Q
                    private_api_key:
                """
        aws_node_provider = AWSNodeProvider()
        error_list = []
        aws_node_provider.validate('prod', yaml.load(single_service_yaml)['prod']['node_provider'], error_list, all_credentials)
        self.assertEqual(len(error_list), 1)
        self.assertEqual("Key 'private_api_key' not defined for AWS in 'prod' environment", error_list[0])