diff --git a/fauxfactory/__init__.py b/fauxfactory/__init__.py index bab930b..876d9af 100644 --- a/fauxfactory/__init__.py +++ b/fauxfactory/__init__.py @@ -82,6 +82,7 @@ def generate_string(cls, str_type, length): * numeric * cjk * utf8 + * html """ # First lowercase the selected str type @@ -99,6 +100,8 @@ def generate_string(cls, str_type, length): return cls.generate_cjk(length) elif str_type == "utf8": return cls.generate_utf8(length) + elif str_type == "html": + return cls.generate_html(length) else: raise Exception("%s is not a supported string type." % str_type) diff --git a/tests/test_strings.py b/tests/test_strings.py index 39d3e25..10465b1 100644 --- a/tests/test_strings.py +++ b/tests/test_strings.py @@ -586,3 +586,13 @@ def test_generate_string3(self): numeric_string = self.factory.generate_string('numeric', 20) self.assertEqual(20, len(numeric_string), "Generated string does not have the expected length") + + def test_generate_string4(self): + """ + @Test: Create a html string with the given length + @Feature: String generator + @Assert: HTML string is created and should greater than given length + """ + html_string = self.factory.generate_string('html', 10) + self.assertTrue(len(html_string) > 10, + "Generated string does not have the expected length")