def test_aws_utils(self): if not USING_PYTHON2: self.assertTrue( isinstance(get_ondemand_price_usd("us-east-1", "t2.micro"), str)) self.assertEquals(str(ARN(region="", account_id="")), "arn:aws::::") self.assertTrue(str(ARN()).startswith("arn:aws:")) self.assertEquals(str(ARN("arn:aws:foo:bar:xyz:zzt")), "arn:aws:foo:bar:xyz:zzt") self.assertEquals( str( ARN("arn:aws:a:b:c:d", service="x", region="us-west-1", account_id="1", resource="2")), "arn:aws:x:us-west-1:1:2") get_user_data(commands=["ls"], packages=["foo"], files=["bar"]) # Test serialization of tweak.Config objects from tweak import Config d = dict(x={}, y=[1, 2]) c = Config(save_on_exit=False, _parent=self, _data=d) aegea.util.aws.dns.config = c c.dns = {} c.dns.private_zone = "aegea.test" with self.assertRaises(AegeaException): aegea.util.aws.dns.DNSZone(create_default_private_zone=False) with self.assertRaises(AegeaException): aegea.util.aws.dns.DNSZone(zone_name="foobar", create_default_private_zone=False) self.assertEquals(get_user_data(foo=c, bar=2), get_user_data(bar=2, foo=c)) # ensure_s3_bucket() self.assertEqual(encode_tags(["foo=bar"]), [{ 'Key': 'foo', 'Value': 'bar' }]) self.assertEqual(encode_tags(dict(foo="bar")), [{ 'Key': 'foo', 'Value': 'bar' }]) self.assertEqual(decode_tags([dict(Key="foo", Value="bar")]), {'foo': 'bar'}) filter_by_tags(resources.ec2.instances, Name="") self.assertEqual(get_bdm(), [ dict(VirtualName="ephemeral" + str(i), DeviceName="xvd" + chr(ord("b") + i)) for i in range(12) ]) # for instance in resources.ec2.instances.all(): # get_iam_role_for_instance(instance.id) # break make_waiter(clients.efs.describe_file_systems, "FileSystems[].LifeCycleState", "available", "pathAny")
def test_aws_utils(self): self.assertTrue(isinstance(get_ondemand_price_usd("us-east-1", "t2.micro"), str)) self.assertEquals(str(ARN(region="", account_id="")), "arn:aws::::") self.assertTrue(str(ARN()).startswith("arn:aws:")) self.assertEquals(str(ARN("arn:aws:foo:bar:xyz:zzt")), "arn:aws:foo:bar:xyz:zzt") self.assertEquals(str(ARN("arn:aws:a:b:c:d", service="x", region="us-west-1", account_id="1", resource="2")), "arn:aws:x:us-west-1:1:2") with self.assertRaises(AegeaException): DNSZone(use_unique_private_zone=False) get_user_data(commands=["ls"], packages=["foo"], files=["bar"]) # Test serialization of tweak.Config objects from tweak import Config d = dict(x={}, y=[1, 2]) c = Config(save_on_exit=False, _parent=self, _data=d) self.assertEquals(get_user_data(foo=c, bar=2), get_user_data(bar=2, foo=c))