def test_gen_uuid_is_string(self): pg = ParamGen(**self.class_kwargs) generated_uuid = pg._gen_uuid() self.assertEqual(type(generated_uuid), type(str()))
def test_param_value_none_raises_exception(self): params = copy.deepcopy(self.class_kwargs) params["param_dict"] = {"Foo": None} with self.assertRaises(TaskCatException): _ = ParamGen(**params)
def test_gen_rand_num(self): genstr = ParamGen._gen_rand_num(24) self.assertRegex(genstr, re.compile("[0-9]"))
def test_gen_rand_num_len(self): genstr = ParamGen._gen_rand_num(78) self.assertEqual(len(genstr), 78)
def test_gen_rand_str_regex(self): genstr = ParamGen._gen_rand_str(24) self.assertRegex(genstr, re.compile("[a-z]"))
def test_gen_rand_str_len(self): genstr = ParamGen._gen_rand_str(33) self.assertEqual(len(genstr), 33)
def test_genpassword_length(self): pg = ParamGen(**self.class_kwargs) self.assertEqual(len(pg.genpassword(15)), 15)
def test_genaz_raises_taskcat_exception(self): pg = ParamGen(**self.class_kwargs) pg._boto_client = MockSingleAZClient with self.assertRaises(TaskCatException): pg.get_available_azs(2)
def test_special_regular_expression(self): pg = ParamGen(**self.class_kwargs) self.assertEqual(pg.regxfind(ParamGen.RE_COUNT, "$[taskcat_getaz_2]"), "2") self.assertEqual(pg.regxfind(ParamGen.RE_COUNT, "$[taskcat_genpass_8]"), "8")
def test_regxfind(self): pg = ParamGen(**self.class_kwargs) re_object = re.compile("foo") self.assertEqual(pg.regxfind(re_object, "aslkjfafoo"), "foo")
def test_convert_to_str(self): pg = ParamGen(**self.class_kwargs) pg.param_name = "test_param" pg.param_value = 1234 pg.convert_to_str() self.assertEqual(pg.param_value, "1234")