Compare commits
1 Commits
main
...
initialize
Author | SHA1 | Date | |
---|---|---|---|
f5387b1905 |
16
.gitignore
vendored
16
.gitignore
vendored
@ -1,16 +1,2 @@
|
|||||||
venv/
|
|
||||||
|
|
||||||
*.pyc
|
|
||||||
__pycache__/
|
__pycache__/
|
||||||
|
venv/
|
||||||
instance/
|
|
||||||
|
|
||||||
.pytest_cache/
|
|
||||||
.coverage
|
|
||||||
htmlcov/
|
|
||||||
|
|
||||||
dist/
|
|
||||||
build/
|
|
||||||
*.egg-info/
|
|
||||||
*.sqlite
|
|
||||||
*.db
|
|
@ -1,26 +0,0 @@
|
|||||||
import os
|
|
||||||
from flask import Flask
|
|
||||||
|
|
||||||
from app.users.api import bp as users_api_blueprint
|
|
||||||
|
|
||||||
def create_app(test_config=None):
|
|
||||||
app = Flask(__name__, instance_relative_config=True)
|
|
||||||
app.config.from_mapping(
|
|
||||||
SECRET_KEY='dev',
|
|
||||||
DATABASE=os.path.join(app.instance_path, 'db.sqlite')
|
|
||||||
)
|
|
||||||
|
|
||||||
if test_config is None:
|
|
||||||
app.config.from_pyfile('config.py', silent=True)
|
|
||||||
else:
|
|
||||||
app.config.from_mapping(test_config)
|
|
||||||
|
|
||||||
try:
|
|
||||||
os.makedirs(app.instance_path)
|
|
||||||
except OSError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
app.register_blueprint(users_api_blueprint)
|
|
||||||
|
|
||||||
|
|
||||||
return app
|
|
@ -1,6 +0,0 @@
|
|||||||
from flask import jsonify, Blueprint
|
|
||||||
|
|
||||||
bp = Blueprint('users_api', __name__, url_prefix="/api/users")
|
|
||||||
@bp.route('', methods=['GET'])
|
|
||||||
def list():
|
|
||||||
return jsonify([])
|
|
@ -1,3 +0,0 @@
|
|||||||
export FLASK_APP=app
|
|
||||||
export FLASK_ENV=development
|
|
||||||
flask run
|
|
@ -1,25 +0,0 @@
|
|||||||
import os
|
|
||||||
import tempfile
|
|
||||||
|
|
||||||
import pytest
|
|
||||||
from app import create_app
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def app():
|
|
||||||
app = create_app({
|
|
||||||
'TESTING': True,
|
|
||||||
'DATABASE': ':memory:',
|
|
||||||
})
|
|
||||||
|
|
||||||
with app.app_context():
|
|
||||||
pass
|
|
||||||
|
|
||||||
yield app
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def client(app):
|
|
||||||
return app.test_client()
|
|
||||||
|
|
||||||
@pytest.fixture
|
|
||||||
def runner(app):
|
|
||||||
return app.test_cli_runner()
|
|
@ -1,4 +0,0 @@
|
|||||||
def test_list_users(client):
|
|
||||||
response = client.get('/api/users')
|
|
||||||
assert response.status_code == 200
|
|
||||||
assert response.json == []
|
|
Loading…
Reference in New Issue
Block a user