WIP: Testing the tests ;)

parent e2ebbfbf
......@@ -11,3 +11,4 @@
/build/*
.vscode
new_asg.txt
src/*
#!/usr/bin/env python3
import unittest
from moto import mock_ec2
from moto import mock_elbv2
from moto import mock_iam
from moto import mock_sts
from moto import mock_s3
from moto import mock_autoscaling
import boto3
from akinaka_update.asg import update_asg
from akinaka_update.targetgroup import update_targetgroup
class TestUpdateASG(unittest.TestCase):
@classmethod
@mock_ec2
@mock_elbv2
@mock_iam
@mock_sts
@mock_autoscaling
def setUp(self):
asg_client = boto3.client('autoscaling', region_name='eu-west-1')
elb_client = boto3.client('elbv2', region_name='eu-west-1')
elb_client.create_target_group(
Name="multi_targetgroup",
)
asg_client.create_auto_scaling_group(
AutoScalingGroupName='multi_targetgroup_blue',
MinSize=1,
MaxSize=1,
AvailabilityZones=['eu-west-1']
)
@mock_ec2
@mock_elbv2
@mock_iam
@mock_sts
@mock_autoscaling
def test_scale(self):
"""
Given a target group, returns it's ARN
Given a load balancer with a single target group, returns that target group's ARN
"""
self.asg = update_asg.ASG(
ami="ami-04df31188f11f32d7",
region="eu-central-1",
role_arn="arn:aws:iam::883986860371:role/production_assumable",
loadbalancer=None,
asg=None,
target_group="webapi",
scale_to="scale_to")
result = self.asg.scale("foobar", 1, 1, 1)
self.assertEqual(result, 6)
if __name__ == '__main__':
unittest.main()
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment