Initial commit
This commit is contained in:
commit
260ce435b0
3
.gitignore
vendored
Normal file
3
.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
.pyenv/
|
||||||
|
.vscode/
|
||||||
|
__pycache__/
|
16
main.py
Normal file
16
main.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import sys
|
||||||
|
|
||||||
|
from flask.wrappers import Response
|
||||||
|
|
||||||
|
|
||||||
|
def url_home() -> Response:
|
||||||
|
...
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
|
||||||
|
def main() -> int:
|
||||||
|
# Start Flask
|
||||||
|
return 0
|
||||||
|
|
||||||
|
sys.exit(main())
|
1
requirements.txt
Normal file
1
requirements.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
flask
|
7
slinky/__init__.py
Normal file
7
slinky/__init__.py
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
def random_string(length: int = 4) -> str:
|
||||||
|
allowed_chars: str = string.ascii_letters + string.digits
|
||||||
|
|
||||||
|
return ''.join(random.SystemRandom().choice(allowed_chars) for _ in range(length))
|
0
tests/__init__.py
Normal file
0
tests/__init__.py
Normal file
16
tests/test_slinky.py
Normal file
16
tests/test_slinky.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from unittest import TestCase
|
||||||
|
|
||||||
|
import slinky
|
||||||
|
|
||||||
|
|
||||||
|
class TestSlinky(TestCase):
|
||||||
|
def test_random_string(self) -> None:
|
||||||
|
"""
|
||||||
|
Ensure the random string generates correctly
|
||||||
|
"""
|
||||||
|
|
||||||
|
self.assertEqual(4, len(slinky.random_string()))
|
||||||
|
self.assertEqual(8, len(slinky.random_string(8)))
|
||||||
|
self.assertEqual(16, len(slinky.random_string(16)))
|
||||||
|
self.assertEqual(64, len(slinky.random_string(64)))
|
||||||
|
self.assertTrue(slinky.random_string(128).isalnum(), True)
|
Loading…
Reference in a new issue