Chromium Code Reviews| Index: components/test/data/autofill/automated_integration/autofill_task/generator.py |
| diff --git a/components/test/data/autofill/automated_integration/autofill_task/generator.py b/components/test/data/autofill/automated_integration/autofill_task/generator.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..75097bce9291b94838313afb96e3f5d0bf6109b9 |
| --- /dev/null |
| +++ b/components/test/data/autofill/automated_integration/autofill_task/generator.py |
| @@ -0,0 +1,40 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +from random import choice |
| +from string import ascii_lowercase |
| + |
| + |
| +class Generator(object): |
| + """A string generator utility. |
| + """ |
| + def __init__(self): |
| + super(Generator, self).__init__() |
| + |
| + @staticmethod |
| + def _lower_case_string(length=8): |
| + return ''.join(choice(ascii_lowercase) for i in range(length)) |
| + |
| + @staticmethod |
| + def email(): |
| + """Generates a fake email address. |
| + |
| + Format: 8 character string at an 8 character .com domain name |
| + |
| + Returns: The generated email address string. |
| + """ |
| + return '%s@%s.com' % (Generator._lower_case_string(), |
| + Generator._lower_case_string()) |
| + |
| + @staticmethod |
| + def password(): |
| + """Generates a fake password. |
| + |
| + Format: 8 character lowercase string plus 'A!234&' |
| + The postpended string exists to assist in satisfying common "secure |
|
sebsg
2016/07/21 19:41:42
Tab for subsequent lines in a section.
|
| + password" requirements |
| + |
| + Returns: The generated password string. |
| + """ |
| + return 'A!234&%s' % Generator._lower_case_string() |