mirror of
https://github.com/aljazceru/CTFd.git
synced 2025-12-17 14:04:20 +01:00
Bump Dependencies (#2332)
* Bump dependencies * Closes #2300 * Closes #2331
This commit is contained in:
@@ -119,9 +119,7 @@ def test_user_bad_login():
|
||||
with client.session_transaction() as sess:
|
||||
assert sess.get("id") is None
|
||||
r = client.get("/profile")
|
||||
assert r.location.startswith(
|
||||
"http://localhost/login"
|
||||
) # We got redirected to login
|
||||
assert r.location.startswith("/login") # We got redirected to login
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
@@ -132,9 +130,7 @@ def test_user_login():
|
||||
register_user(app)
|
||||
client = login_as_user(app)
|
||||
r = client.get("/profile")
|
||||
assert (
|
||||
r.location != "http://localhost/login"
|
||||
) # We didn't get redirected to login
|
||||
assert r.location is None # We didn't get redirected to login
|
||||
assert r.status_code == 200
|
||||
destroy_ctfd(app)
|
||||
|
||||
@@ -146,9 +142,7 @@ def test_user_login_with_email():
|
||||
register_user(app)
|
||||
client = login_as_user(app, name="user@examplectf.com", password="password")
|
||||
r = client.get("/profile")
|
||||
assert (
|
||||
r.location != "http://localhost/login"
|
||||
) # We didn't get redirected to login
|
||||
assert r.location is None # We didn't get redirected to login
|
||||
assert r.status_code == 200
|
||||
destroy_ctfd(app)
|
||||
|
||||
@@ -161,7 +155,7 @@ def test_user_get_logout():
|
||||
client = login_as_user(app)
|
||||
client.get("/logout", follow_redirects=True)
|
||||
r = client.get("/challenges")
|
||||
assert r.location == "http://localhost/login?next=%2Fchallenges%3F"
|
||||
assert r.location == "/login?next=%2Fchallenges%3F"
|
||||
assert r.status_code == 302
|
||||
destroy_ctfd(app)
|
||||
|
||||
@@ -182,7 +176,7 @@ def test_user_isnt_admin():
|
||||
"config",
|
||||
]:
|
||||
r = client.get("/admin/{}".format(page))
|
||||
assert r.location.startswith("http://localhost/login?next=")
|
||||
assert r.location.startswith("/login?next=")
|
||||
assert r.status_code == 302
|
||||
destroy_ctfd(app)
|
||||
|
||||
@@ -302,7 +296,7 @@ def test_user_can_confirm_email(mock_smtp):
|
||||
|
||||
client = login_as_user(app, name="user1", password="password")
|
||||
|
||||
r = client.get("http://localhost/confirm")
|
||||
r = client.get("/confirm")
|
||||
assert "We've sent a confirmation email" in r.get_data(as_text=True)
|
||||
|
||||
# smtp send message function was called
|
||||
@@ -310,23 +304,21 @@ def test_user_can_confirm_email(mock_smtp):
|
||||
|
||||
with client.session_transaction() as sess:
|
||||
data = {"nonce": sess.get("nonce")}
|
||||
r = client.post("http://localhost/confirm", data=data)
|
||||
r = client.post("/confirm", data=data)
|
||||
assert "Confirmation email sent to" in r.get_data(as_text=True)
|
||||
|
||||
r = client.get("/challenges")
|
||||
assert (
|
||||
r.location == "http://localhost/confirm"
|
||||
) # We got redirected to /confirm
|
||||
assert r.location == "/confirm" # We got redirected to /confirm
|
||||
|
||||
r = client.get("http://localhost/confirm/" + serialize("user@user.com"))
|
||||
assert r.location == "http://localhost/challenges"
|
||||
r = client.get("/confirm/" + serialize("user@user.com"))
|
||||
assert r.location == "/challenges"
|
||||
|
||||
# The team is now verified
|
||||
user = Users.query.filter_by(email="user@user.com").first()
|
||||
assert user.verified is True
|
||||
|
||||
r = client.get("http://localhost/confirm")
|
||||
assert r.location == "http://localhost/settings"
|
||||
r = client.get("/confirm")
|
||||
assert r.location == "/settings"
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
@@ -462,7 +454,7 @@ def test_registration_code_required():
|
||||
data["registration_code"] = "secret-sauce"
|
||||
r = client.post("/register", data=data)
|
||||
assert r.status_code == 302
|
||||
assert r.location.startswith("http://localhost/challenges")
|
||||
assert r.location.startswith("/challenges")
|
||||
destroy_ctfd(app)
|
||||
|
||||
|
||||
@@ -492,5 +484,5 @@ def test_registration_code_allows_numeric():
|
||||
data["registration_code"] = "1234567890"
|
||||
r = client.post("/register", data=data)
|
||||
assert r.status_code == 302
|
||||
assert r.location.startswith("http://localhost/challenges")
|
||||
assert r.location.startswith("/challenges")
|
||||
destroy_ctfd(app)
|
||||
|
||||
Reference in New Issue
Block a user