-
Notifications
You must be signed in to change notification settings - Fork 111
/
Copy pathtodolist.py
32 lines (24 loc) · 821 Bytes
/
todolist.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
from app import create_app
import os
from dotenv import load_dotenv
dotenv_path = os.path.join(os.path.dirname(__file__), ".env")
if os.path.exists(dotenv_path):
load_dotenv(dotenv_path)
app = create_app("development")
@app.cli.command()
def test():
"""Runs the unit tests."""
import sys
import unittest
tests = unittest.TestLoader().discover("tests")
result = unittest.TextTestRunner(verbosity=2).run(tests)
if result.errors or result.failures:
sys.exit(1)
@app.cli.command()
def fill_db():
"""Fills database with random data.
By default 10 users, 40 todolists and 160 todos.
WARNING: will delete existing data. For testing purposes only.
"""
from utils.fake_generator import FakeGenerator
FakeGenerator().start() # side effect: deletes existing data