-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
459a790
commit 77dc9f0
Showing
2 changed files
with
41 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
get_api_requests_for_one_user, | ||
) | ||
|
||
from datetime import datetime, timedelta | ||
|
||
def test_get_user(db_session): | ||
db_session.add(UserSQL(email="[email protected]")) | ||
|
@@ -41,3 +42,24 @@ def test_get_api_requests_for_one_user(db_session): | |
requests_sql = get_api_requests_for_one_user(session=db_session, email=user.email) | ||
assert len(requests_sql) == 1 | ||
assert requests_sql[0].url == "test" | ||
|
||
|
||
def test_get_api_requests_for_one_user_start_datetime(db_session): | ||
user = get_user(session=db_session, email="[email protected]") | ||
db_session.add(APIRequestSQL(user_uuid=user.uuid, url="test")) | ||
|
||
requests_sql = get_api_requests_for_one_user( | ||
session=db_session, email=user.email, start_datetime=datetime.now() + timedelta(hours=1) | ||
) | ||
assert len(requests_sql) == 0 | ||
|
||
|
||
def test_get_api_requests_for_one_user_end_datetime(db_session): | ||
user = get_user(session=db_session, email="[email protected]") | ||
db_session.add(APIRequestSQL(user_uuid=user.uuid, url="test")) | ||
|
||
requests_sql = get_api_requests_for_one_user( | ||
session=db_session, email=user.email, start_datetime=datetime.now() - timedelta(hours=1) | ||
) | ||
assert len(requests_sql) == 0 | ||
|