-
-
Notifications
You must be signed in to change notification settings - Fork 239
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
4f91bd4
commit 9e066da
Showing
3 changed files
with
52 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ def test_get_profile(self): | |
|
||
|
||
if __name__ == "__main__": | ||
unittest.main() | ||
unittest.main() |
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 |
---|---|---|
@@ -0,0 +1,50 @@ | ||
import unittest | ||
from scrape_up import codeforces | ||
|
||
class CodeforcesTest(unittest.TestCase): | ||
""" | ||
Codeforces module test.\n | ||
| Methods | Details | | ||
| ----------------------------- | ---------------------------------------------------------------- | | ||
| `get_user_data(username)` | Fetches user data from CodeForces. | | ||
| `get_contests()` | Returns information on active and past contests like title, start, and duration | | ||
""" | ||
|
||
def test_get_user_data(self): | ||
instance = codeforces.Users(username="tourist") | ||
method_response = instance.get_user_data() | ||
|
||
self.assertEqual( | ||
list(method_response.keys()), | ||
[ | ||
"rank", | ||
"handle", | ||
"firstname", | ||
"lastname", | ||
"city", | ||
"country", | ||
"organization", | ||
"rating", | ||
"contribution", | ||
"friendsofcount", | ||
"lastvisit", | ||
"registered", | ||
"titlephoto", | ||
"avatar" | ||
], | ||
"Codeforces:get_user_data - keys mismatch", | ||
) | ||
def test_get_contests(self): | ||
instance = codeforces.Contest() | ||
method_response = instance.get_contests() | ||
|
||
self.assertEqual( | ||
list(method_response.keys()), | ||
[ | ||
"upcoming_contest", | ||
"ended_contest" | ||
], | ||
"Codeforces:get_contests - keys mismatch", | ||
) | ||
|
||
|
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