-
Notifications
You must be signed in to change notification settings - Fork 5
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
Showing
3 changed files
with
26 additions
and
22 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,7 +13,7 @@ class TestUserPage: | |
phone = "012-345-6789" | ||
password = "newpassword1234" | ||
email = "[email protected]" | ||
userpage = None | ||
userpage = UserPage(username) | ||
main_page_staging = MainPageStaging() | ||
|
||
@use_database | ||
|
@@ -48,14 +48,18 @@ def test_invalid_input(self): | |
|
||
@use_test | ||
def test_get_user(self): | ||
"""get_user returns correct Use""" | ||
"""get_user returns correct User""" | ||
self.initialize() | ||
res = self.userpage.get_user(self.username) | ||
print(res) | ||
assert res.username == self.username | ||
assert res.password == "beginpassword" | ||
assert res.email == "[email protected]" | ||
assert res.phone == "111-555-0022" | ||
assert self.userpage.get_user("sd") is None | ||
assert ( | ||
self.userpage.get_user("sd").email == "" | ||
and self.userpage.get_user("sd").user_id == "" | ||
) | ||
self.test_cleanup_db() | ||
|
||
@use_test | ||
|
@@ -116,18 +120,18 @@ def test_get_liked(self): | |
self.main_page_staging.initialize_all() | ||
connection = sqlite3.connect("database/database_test.db") | ||
cursor = connection.cursor() | ||
minh_phan_id = cursor.execute( | ||
"SELECT user_id FROM Users WHERE (username = 'Minh Phan')" | ||
big_finger_id = cursor.execute( | ||
"SELECT user_id FROM Users WHERE (username = 'Big_finger')" | ||
).fetchone()[0] | ||
sherman_id = cursor.execute( | ||
"SELECT apt_id FROM Apartments WHERE (apt_name = 'Sherman')" | ||
far_id = cursor.execute( | ||
"SELECT apt_id FROM Apartments WHERE (apt_name = 'FAR')" | ||
).fetchone()[0] | ||
res = self.userpage.get_liked(minh_phan_id) | ||
res = self.userpage.get_liked(big_finger_id) | ||
liked = [] | ||
liked.append(Apt(sherman_id, "Sherman", "909 S 5th St", 0.333, 5500, 6500)) | ||
liked.append(Apt(far_id, "FAR", "901 W College Ct", 1, 6000, 7000)) | ||
self.main_page_staging.clean_all() | ||
self.test_cleanup_db() | ||
assert res == liked | ||
assert res[1] == liked[0] | ||
|
||
@use_test | ||
def test_cleanup_db(self): | ||
|
8cecab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report
8cecab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report
8cecab2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Coverage Report