Skip to content

Commit

Permalink
Make hostname more random. Reuse get_random_hostname() for emails
Browse files Browse the repository at this point in the history
  • Loading branch information
ecederstrand committed Jan 27, 2022
1 parent 6749d1c commit 08b6dd4
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,8 @@ def get_random_bytes(length):


def get_random_hostname():
domain_len = random.randint(1, 30)
tld_len = random.randint(2, 4)
domain_len = random.randint(16, 32)
tld_len = random.randint(4, 6)
return "%s.%s" % tuple(get_random_string(i, spaces=False, special=False).lower() for i in (domain_len, tld_len))


Expand All @@ -370,11 +370,7 @@ def get_random_url():

def get_random_email():
account_len = random.randint(1, 6)
domain_len = random.randint(1, 30)
tld_len = random.randint(2, 4)
return "%s@%s.%s" % tuple(
map(lambda i: get_random_string(i, spaces=False, special=False).lower(), (account_len, domain_len, tld_len))
)
return "%s@%s" % (get_random_string(account_len, spaces=False, special=False).lower(), get_random_hostname())


def _total_minutes(tm):
Expand Down

0 comments on commit 08b6dd4

Please sign in to comment.