-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #71 from ECE444-2023Fall/search
Changing the backend for search to query the database
- Loading branch information
Showing
5 changed files
with
111 additions
and
164 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
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 |
---|---|---|
|
@@ -457,7 +457,7 @@ def test_event_by_id(test_client): | |
|
||
with app.app_context(): | ||
assert event.title == "Event 1" | ||
|
||
def test_null_club(test_client): | ||
user = UserDataLayer() | ||
user.create_user( | ||
|
@@ -494,4 +494,53 @@ def test_null_club(test_client): | |
|
||
with app.app_context(): | ||
event = Event.query.filter_by(title="Event 1").first() | ||
assert event.club == None | ||
assert event.club == None | ||
|
||
def test_search_by_keyword(test_client): | ||
user = UserDataLayer() | ||
user.create_user( | ||
username="testuser1", | ||
email="[email protected]", | ||
password_hash="testpassword", | ||
password_salt="testpassword", | ||
) | ||
|
||
event = EventDataLayer() | ||
event.create_event( | ||
title="Event 1", | ||
description="Kickoff for club 1", | ||
extended_description="Extended decription for event 1 for club 1 that is much longer than just the description", | ||
location="Toronto", | ||
start_time="2023-10-03 3:30:00", | ||
end_time="2023-10-03 4:00:00", | ||
author_name='testuser1', | ||
club="club 1", | ||
is_published=True, | ||
image=None, | ||
) | ||
event.create_event( | ||
title="Faculty party planning", | ||
description="Join us at our meeting", | ||
extended_description="Extended decription for faculty party planning, longer than the description", | ||
location="UC college", | ||
start_time="2023-10-03 3:30:00", | ||
end_time="2023-10-03 4:00:00", | ||
author_name='testuser1', | ||
club="Faculty Event Planning", | ||
is_published=True, | ||
image=None, | ||
) | ||
|
||
try: | ||
query_results = event.get_search_results_by_keyword(keyword='Ev') | ||
except ValueError as value_error: | ||
logging.debug(f'Error: {value_error}') | ||
assert value_error == None | ||
except TypeError as type_error: | ||
logging.debug(f'Error: {type_error}') | ||
assert type_error == None | ||
|
||
with app.app_context(): | ||
assert len(query_results) == 2 | ||
assert query_results[0].title == "Event 1" | ||
assert query_results[1].club == "Faculty Event Planning" |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.