# Path: stacker_blueprints/ec2.py
# class Instances(Blueprint):
#     """ Manages the creation of EC2 Instance resources. """
# 
#     VARIABLES = {
#         "Instances": {
#             "type": TroposphereType(ec2.Instance, many=True),
#             "description": "Dictionary of EC2 Instance definitions.",
#         },
#     }
# 
#     def create_template(self):
#         t = self.template
#         variables = self.get_variables()
# 
#         for instance in variables["Instances"]:
#             t.add_resource(instance)
#             title = instance.title
#             t.add_output(
#                 Output(title + "InstanceId", Value=instance.Ref())
#             )
#             t.add_output(
#                 Output(
#                     title + "AZ", Value=instance.GetAtt("AvailabilityZone")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PrivateDnsName",
#                     Value=instance.GetAtt("PrivateDnsName")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PublicDnsName",
#                     Value=instance.GetAtt("PublicDnsName")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PrivateIp",
#                     Value=instance.GetAtt("PrivateIp")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PublicIp",
#                     Value=instance.GetAtt("PublicIp")
#                 )
#             )


from stacker.context import Context
from stacker.variables import Variable
from stacker_blueprints.ec2 import Instances
from stacker.blueprints.testutil import BlueprintTestCase


class TestBlueprint(BlueprintTestCase):
    def setUp(self):
        self.common_variables = [
            Variable(
                "Instances", {
                    "MyInstance": {
                        "ImageId": "ami-abc12345",
                        }
                }
            )
        ]

        self.ctx = Context({'namespace': 'test', 'environment': 'test'})

    def test_ec2_instances(self):

# Path: stacker_blueprints/ec2.py
# class Instances(Blueprint):
#     """ Manages the creation of EC2 Instance resources. """
# 
#     VARIABLES = {
#         "Instances": {
#             "type": TroposphereType(ec2.Instance, many=True),
#             "description": "Dictionary of EC2 Instance definitions.",
#         },
#     }
# 
#     def create_template(self):
#         t = self.template
#         variables = self.get_variables()
# 
#         for instance in variables["Instances"]:
#             t.add_resource(instance)
#             title = instance.title
#             t.add_output(
#                 Output(title + "InstanceId", Value=instance.Ref())
#             )
#             t.add_output(
#                 Output(
#                     title + "AZ", Value=instance.GetAtt("AvailabilityZone")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PrivateDnsName",
#                     Value=instance.GetAtt("PrivateDnsName")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PublicDnsName",
#                     Value=instance.GetAtt("PublicDnsName")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PrivateIp",
#                     Value=instance.GetAtt("PrivateIp")
#                 )
#             )
# 
#             t.add_output(
#                 Output(
#                     title + "PublicIp",
#                     Value=instance.GetAtt("PublicIp")
#                 )
#             )


# Path: tests/test_ec2.py
from stacker.context import Context
from stacker.variables import Variable
from stacker_blueprints.ec2 import Instances
from stacker.blueprints.testutil import BlueprintTestCase



class TestBlueprint(BlueprintTestCase):
    def setUp(self):
        self.common_variables = [
            Variable(
                "Instances", {
                    "MyInstance": {
                        "ImageId": "ami-abc12345",
                        }
                }
            )
        ]

        self.ctx = Context({'namespace': 'test', 'environment': 'test'})

    def test_ec2_instances(self):

        blueprint = Instances("ec2_instances", self.ctx)