mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
@@ -2,18 +2,29 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
from CTFd.models import Hints
|
||||
from tests.helpers import *
|
||||
from tests.helpers import (create_ctfd,
|
||||
destroy_ctfd,
|
||||
register_user,
|
||||
login_as_user,
|
||||
gen_challenge,
|
||||
gen_hint)
|
||||
|
||||
|
||||
def test_api_hint_get_non_admin():
|
||||
"""Can the users get /api/v1/hints if not admin"""
|
||||
app = create_ctfd()
|
||||
with app.app_context():
|
||||
register_user(app)
|
||||
with login_as_user(app) as client:
|
||||
# test_api_hint_get_non_admin
|
||||
"""Can the users get /api/v1/hints if not admin"""
|
||||
r = client.get('/api/v1/hints', json="")
|
||||
assert r.status_code == 403
|
||||
assert Hints.query.count() == 0
|
||||
|
||||
# test_api_hint_post_non_admin
|
||||
"""Can the users post /api/v1/hints if not admin"""
|
||||
r = client.post('/api/v1/hints', json="")
|
||||
assert r.status_code == 403
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
@@ -27,17 +38,6 @@ def test_api_hint_get_admin():
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
def test_api_hint_post_non_admin():
|
||||
"""Can the users post /api/v1/hints if not admin"""
|
||||
app = create_ctfd()
|
||||
with app.app_context():
|
||||
register_user(app)
|
||||
with login_as_user(app) as client:
|
||||
r = client.post('/api/v1/hints', json="")
|
||||
assert r.status_code == 403
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
def test_api_hint_post_admin():
|
||||
"""Can the users post /api/v1/hints if admin"""
|
||||
app = create_ctfd()
|
||||
|
||||
Reference in New Issue
Block a user