Plugins enhanced utils (#231)

* Updating utils functions to be monkey patchable

* Also fixing a team email update issue

* Adding more tests
This commit is contained in:
Kevin Chung
2017-03-22 20:00:45 -04:00
committed by GitHub
parent ede7f1bad2
commit a3a7d75ae8
17 changed files with 351 additions and 195 deletions

View File

@@ -1,5 +1,6 @@
from tests.helpers import create_ctfd, register_user, login_as_user
from tests.helpers import create_ctfd, register_user, login_as_user, gen_challenge
from CTFd.models import Teams
import json
def test_index():
@@ -191,4 +192,16 @@ def test_user_get_reset_password():
register_user(app)
client = app.test_client()
r = client.get('/reset_password')
assert r.status_code == 200
assert r.status_code == 200
def test_viewing_challenges():
"""Test that users can see added challenges"""
app = create_ctfd()
with app.app_context():
register_user(app)
client = login_as_user(app)
gen_challenge(app.db)
r = client.get('/chals')
chals = json.loads(r.data)
assert len(chals['game']) == 1