mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 05:54:19 +01:00
Latest set of changes (#190)
* PEP 8 compliance (#183) * Group imports: standard library, third party, local * Remove unnecessary spaces * Comments should start with a # and a single space * Adding tests for GETs on user facing pages * Adding more user facing tests 51% test coverage * Fixes #182 * Cleaning up Pages Fixes a bug with CSS updating
This commit is contained in:
@@ -2,11 +2,9 @@ from CTFd import create_app
|
||||
from sqlalchemy_utils import database_exists, create_database, drop_database
|
||||
from sqlalchemy.engine.url import make_url
|
||||
|
||||
|
||||
def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="password"):
|
||||
app = create_app()
|
||||
app.config['PRESERVE_CONTEXT_ON_EXCEPTION'] = False
|
||||
app.config['TESTING'] = True
|
||||
app.config['DEBUG'] = True
|
||||
app = create_app('CTFd.config.TestingConfig')
|
||||
|
||||
url = make_url(app.config['SQLALCHEMY_DATABASE_URI'])
|
||||
if url.drivername == 'postgres':
|
||||
@@ -15,7 +13,8 @@ def create_ctfd(ctf_name="CTFd", name="admin", email="admin@ctfd.io", password="
|
||||
if database_exists(url):
|
||||
drop_database(url)
|
||||
create_database(url)
|
||||
app.db.create_all()
|
||||
with app.app_context():
|
||||
app.db.create_all()
|
||||
|
||||
with app.app_context():
|
||||
with app.test_client() as client:
|
||||
|
||||
Reference in New Issue
Block a user