Skip to content
This repository was archived by the owner on Dec 8, 2022. It is now read-only.

Commit ea3756c

Browse files
committed
fix unit testing for Flask-Limiter extension
1 parent 2ce7f4d commit ea3756c

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

tests/conftest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ def client(app):
2020
app.config["MAIL_SUPPRESS_SEND"] = True
2121
app.config["CODE_CHALLENGE_START"] = time.time()
2222
app.config["SANDBOX_API_URL"] = os.getenv("SANDBOX_API_URL")
23+
app.config["ANSWER_ATTEMPT_LIMIT"] = "3/minute"
2324

2425
with app.test_client() as client:
2526
with app.app_context():

tests/test_question.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ def client_challenge_today():
2323
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
2424
app.config["CODE_CHALLENGE_START"] = time.time()
2525
app.config["ALLOW_RESET"] = True
26+
app.config["ANSWER_ATTEMPT_LIMIT"] = "3/minute"
2627

2728
with app.test_client() as client:
2829
with app.app_context():
@@ -50,6 +51,7 @@ def client_challenge_future():
5051
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
5152
app.config["CODE_CHALLENGE_START"] = CC_2D_FUTURE
5253
app.config["SANDBOX_API_URL"] = os.getenv("SANDBOX_API_URL")
54+
app.config["ANSWER_ATTEMPT_LIMIT"] = "3/minute"
5355

5456
with app.test_client() as client:
5557
with app.app_context():
@@ -62,6 +64,7 @@ def client_challenge_past():
6264
app.config["TESTING"] = True
6365
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
6466
app.config["CODE_CHALLENGE_START"] = CC_2D_PRIOR
67+
app.config["ANSWER_ATTEMPT_LIMIT"] = "3/minute"
6568

6669
with app.test_client() as client:
6770
with app.app_context():
@@ -74,6 +77,7 @@ def client_challenge_lastq():
7477
app.config["TESTING"] = True
7578
app.config["SQLALCHEMY_DATABASE_URI"] = "sqlite:///:memory:"
7679
app.config["CODE_CHALLENGE_START"] = CC_4D_PRIOR
80+
app.config["ANSWER_ATTEMPT_LIMIT"] = "3/minute"
7781

7882
with app.test_client() as client:
7983
with app.app_context():

0 commit comments

Comments
 (0)