def test_regional_codename__hash__(self): rc = RegionalCodename( region="us-east-1", cn="AMZNLINUXHVM", filters=[ EC2FilterValue("name", ["amzn-ami-hvm-????.??.?.*-x86_64-gp2"]), EC2FilterValue("owner-alias", ["amazon"]), EC2FilterValue("state", ["available"]), ], ) self.assertTrue(isinstance(rc.__hash__(), int))
def test_build_codenames(self): example_tc_template = self.create_ephemeral_template_object() au_template = Template(example_tc_template["taskcat-json"], ["us-east-1"]) example_config_obj = AUConfig example_config_obj.raw_dict = { "global": { "AMIs": { "AMZNLINUXHVM": { "name": "amzn-ami-hvm-????.??.?.*-x86_64-gp2", "owner-alias": "amazon", } } } } expected = [ RegionalCodename( region="us-east-1", cn="AMZNLINUXHVM", filters=[ EC2FilterValue("name", ["amzn-ami-hvm-????.??.?.*-x86_64-gp2"]), EC2FilterValue("owner-alias", ["amazon"]), EC2FilterValue("state", ["available"]), ], ) ] actual = build_codenames(au_template, example_config_obj) _mocked_dt = datetime.now() for r1 in expected: r1._creation_dt = _mocked_dt for r2 in actual: r2._creation_dt = _mocked_dt self.assertEqual(expected, actual)