mirror of
https://github.com/onionshare/onionshare.git
synced 2025-05-06 08:25:15 -04:00
switch random strings from hex-encoded to base32-encoded
This commit is contained in:
parent
272092f877
commit
4ac7111011
2 changed files with 19 additions and 16 deletions
|
@ -68,17 +68,17 @@ def test_load_strings_loads_other_languages():
|
|||
assert onionshare.strings['calculating_sha1'] == "Calculer un hachage SHA-1."
|
||||
|
||||
def test_generate_slug_length():
|
||||
"generates a 32-character slug"
|
||||
assert len(slug) == 32
|
||||
"generates a 26-character slug"
|
||||
assert len(slug) == 26
|
||||
|
||||
def test_generate_slug_characters():
|
||||
"generates a hex slug"
|
||||
"generates a base32-encoded slug"
|
||||
|
||||
def is_hex(string):
|
||||
hex_alphabet = "01234556789abcdef"
|
||||
return all(char in hex_alphabet for char in string)
|
||||
def is_b32(string):
|
||||
b32_alphabet = "01234556789abcdefghijklmnopqrstuvwxyz"
|
||||
return all(char in b32_alphabet for char in string)
|
||||
|
||||
assert is_hex(slug)
|
||||
assert is_b32(slug)
|
||||
|
||||
def test_starts_with_empty_strings():
|
||||
"creates an empty strings dict by default"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue