From fa9cb2498ba068dcd4e255f91c3be9ec372c9007 Mon Sep 17 00:00:00 2001 From: Kevin Chung Date: Fri, 22 Dec 2017 16:22:31 -0500 Subject: [PATCH] Guarantee ctf version (#538) * Make sure ctf_version is set correctly --- CHANGELOG.md | 2 +- CTFd/__init__.py | 3 +++ tests/test_utils.py | 8 ++++++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c445ab44..38a5af81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -1.1.0 / TBD +1.1.0 / 2017-12-22 ================== **Themes** diff --git a/CTFd/__init__.py b/CTFd/__init__.py index bc29e5b4..e0ee3c68 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -150,6 +150,9 @@ def create_app(config='CTFd.config.Config'): else: exit() + if not version: + utils.set_config('ctf_version', __version__) + if not utils.get_config('ctf_theme'): utils.set_config('ctf_theme', 'core') diff --git a/tests/test_utils.py b/tests/test_utils.py index 6425085a..ee263612 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -17,6 +17,14 @@ import requests import six +def test_ctf_version_is_set(): + """Does ctf_version get set correctly""" + app = create_ctfd() + with app.app_context(): + assert get_config('ctf_version') == app.VERSION + destroy_ctfd(app) + + def test_get_config_and_set_config(): """Does get_config and set_config work properly""" app = create_ctfd()