Initial commit

This commit is contained in:
Scott Wallace 2021-12-19 11:48:42 +00:00
commit 260ce435b0
Signed by: scott
GPG key ID: AA742FDC5AFE2A72
6 changed files with 43 additions and 0 deletions

3
.gitignore vendored Normal file
View file

@ -0,0 +1,3 @@
.pyenv/
.vscode/
__pycache__/

16
main.py Normal file
View 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
View file

@ -0,0 +1 @@
flask

7
slinky/__init__.py Normal file
View 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
View file

16
tests/test_slinky.py Normal file
View 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)