Adopting a challenge type layout from deckar01 (#399)

* Adopting a challenge type layout from deckar01
* Move standard challenge modals into the plugin
* Migration to change challenge type id to a string
* Travis testing now builds with MySQL, SQLite, and Postgres
* Rework get_standings to use the row ID instead of the saved time because of differences in database time precision
This commit is contained in:
Kevin Chung
2017-10-05 21:39:28 -04:00
committed by GitHub
parent faa84ff1e5
commit 608d4f43d9
26 changed files with 275 additions and 102 deletions

View File

@@ -39,6 +39,10 @@ def setup_ctfd(app, ctf_name="CTFd", name="admin", email="admin@ctfd.io", passwo
def destroy_ctfd(app):
with app.app_context():
app.db.session.commit()
app.db.session.close_all()
app.db.drop_all()
drop_database(app.config['SQLALCHEMY_DATABASE_URI'])
@@ -72,11 +76,13 @@ def login_as_user(app, name="user", password="password"):
def get_scores(user):
scores = user.get('/scores')
print(scores.get_data(as_text=True))
scores = json.loads(scores.get_data(as_text=True))
print(scores)
return scores['standings']
def gen_challenge(db, name='chal_name', description='chal_description', value=100, category='chal_category', type=0):
def gen_challenge(db, name='chal_name', description='chal_description', value=100, category='chal_category', type='standard'):
chal = Challenges(name, description, value, category)
db.session.add(chal)
db.session.commit()