|
| 1 | +import solvedac_community as SolvedAC |
| 2 | +import asyncio |
| 3 | +import unittest |
| 4 | + |
| 5 | +loop = asyncio.get_event_loop() |
| 6 | + |
| 7 | +client = SolvedAC.Client() |
| 8 | + |
| 9 | +user_list = ["devruby"] |
| 10 | + |
| 11 | +background_list = [ |
| 12 | + "users_100k" |
| 13 | +] |
| 14 | + |
| 15 | +badge_list = ["ghudegy2023"] |
| 16 | + |
| 17 | +query_list = ["graph"] |
| 18 | + |
| 19 | +search_query_list = zip( |
| 20 | + ("tree",), |
| 21 | + ("asc",), |
| 22 | + (1,), |
| 23 | + ("id",), |
| 24 | +) |
| 25 | + |
| 26 | +problem_id_array_list = [ |
| 27 | + [1000, 1001, 1002, 1003, 1004], |
| 28 | +] |
| 29 | + |
| 30 | +problem_id_list = [1000] |
| 31 | + |
| 32 | +DEBUG = True |
| 33 | + |
| 34 | + |
| 35 | +class Test(unittest.TestCase): |
| 36 | + def test_get_user(self): |
| 37 | + for user in user_list: |
| 38 | + if DEBUG: |
| 39 | + print(loop.run_until_complete(client.get_user(user))) |
| 40 | + else: |
| 41 | + (loop.run_until_complete(client.get_user(user))) |
| 42 | + |
| 43 | + def test_get_user_organizations(self): |
| 44 | + for user in user_list: |
| 45 | + if DEBUG: |
| 46 | + print(loop.run_until_complete(client.get_user_organizations(user))) |
| 47 | + else: |
| 48 | + (loop.run_until_complete(client.get_user_organizations(user))) |
| 49 | + |
| 50 | + def test_get_user_problem_stats(self): |
| 51 | + for user in user_list: |
| 52 | + if DEBUG: |
| 53 | + print(loop.run_until_complete(client.get_user_problem_stats(user))) |
| 54 | + else: |
| 55 | + (loop.run_until_complete(client.get_user_problem_stats(user))) |
| 56 | + |
| 57 | + def test_get_background(self): |
| 58 | + for background in background_list: |
| 59 | + if DEBUG: |
| 60 | + print(loop.run_until_complete(client.get_background(background))) |
| 61 | + else: |
| 62 | + (loop.run_until_complete(client.get_background(background))) |
| 63 | + |
| 64 | + def test_get_badge(self): |
| 65 | + for badge in badge_list: |
| 66 | + if DEBUG: |
| 67 | + print(loop.run_until_complete(client.get_badge(badge))) |
| 68 | + else: |
| 69 | + (loop.run_until_complete(client.get_badge(badge))) |
| 70 | + |
| 71 | + def test_get_coins_exchange_rate(self): |
| 72 | + if DEBUG: |
| 73 | + print(loop.run_until_complete(client.get_coins_exchange_rate())) |
| 74 | + else: |
| 75 | + (loop.run_until_complete(client.get_coins_exchange_rate())) |
| 76 | + |
| 77 | + def test_get_coin_shop_products(self): |
| 78 | + if DEBUG: |
| 79 | + print(loop.run_until_complete(client.get_coinshop_products())) |
| 80 | + else: |
| 81 | + (loop.run_until_complete(client.get_coinshop_products())) |
| 82 | + |
| 83 | + def test_get_site_stats(self): |
| 84 | + if DEBUG: |
| 85 | + print(loop.run_until_complete(client.get_site_stats())) |
| 86 | + else: |
| 87 | + (loop.run_until_complete(client.get_site_stats())) |
| 88 | + |
| 89 | + def test_get_problem_by_id_array(self): |
| 90 | + for problem_id_array in problem_id_array_list: |
| 91 | + if DEBUG: |
| 92 | + print(loop.run_until_complete(client.get_problem_by_id_array(problem_id_array))) |
| 93 | + else: |
| 94 | + (loop.run_until_complete(client.get_problem_by_id_array(problem_id_array))) |
| 95 | + |
| 96 | + def test_get_problem_by_id(self): |
| 97 | + for problem_id in problem_id_list: |
| 98 | + if DEBUG: |
| 99 | + print(loop.run_until_complete(client.get_problem_by_id(problem_id))) |
| 100 | + else: |
| 101 | + (loop.run_until_complete(client.get_problem_by_id(problem_id))) |
| 102 | + |
| 103 | + def test_get_problem_level(self): |
| 104 | + if DEBUG: |
| 105 | + print(loop.run_until_complete(client.get_problem_level())) |
| 106 | + else: |
| 107 | + (loop.run_until_complete(client.get_problem_level())) |
| 108 | + |
| 109 | + def test_search_problem(self): |
| 110 | + for query, direction, page, sort in search_query_list: |
| 111 | + if DEBUG: |
| 112 | + print(loop.run_until_complete(client.search_problem(query, direction, page, sort))) |
| 113 | + else: |
| 114 | + print(loop.run_until_complete(client.search_problem(query, direction, page, sort))) |
| 115 | + |
| 116 | + def test_get_search_auto_completion(self): |
| 117 | + for query in query_list: |
| 118 | + if DEBUG: |
| 119 | + print(loop.run_until_complete(client.get_search_auto_completion(query))) |
| 120 | + else: |
| 121 | + (loop.run_until_complete(client.get_search_auto_completion(query))) |
| 122 | + |
| 123 | + |
| 124 | +if __name__ == "__main__": |
| 125 | + unittest.main() |
0 commit comments