|
1 | | -import asyncio # NOTE: don't comment this out; it's required |
2 | 1 | import json |
3 | 2 | from datetime import date, timedelta |
4 | 3 |
|
|
16 | 15 |
|
17 | 16 | async def test__read_execs(db_session): |
18 | 17 | # test that reads from the database succeeded as expected |
19 | | - print(type(db_session)) |
20 | 18 | assert (await get_active_officer_terms(db_session, "blarg")) == [] |
21 | 19 | assert (await get_active_officer_terms(db_session, "abc22")) != [] |
22 | 20 |
|
@@ -55,8 +53,7 @@ async def test__read_execs(db_session): |
55 | 53 | # pass |
56 | 54 |
|
57 | 55 | async def test__get_officers(client): |
58 | | - # private data shoudn't be leaked |
59 | | - print(f"[DEBUG] Loop ID in {__name__}: {id(asyncio.get_running_loop())}") |
| 56 | + # private data shouldn't be leaked |
60 | 57 | response = await client.get("/officers/current") |
61 | 58 | assert response.status_code == 200 |
62 | 59 | assert response.json() != {} |
@@ -172,20 +169,15 @@ async def test__patch_officer_terms(client: AsyncClient): |
172 | 169 | response = await client.delete("officers/term/1") |
173 | 170 | assert response.status_code == 401 |
174 | 171 |
|
175 | | -@pytest.mark.skip |
176 | | -async def test__endpoints_admin(client, database_setup, admin_session): |
177 | | - # login as website admin |
178 | | - session_id = "temp_id_" + load_test_db.SYSADMIN_COMPUTING_ID |
179 | | - |
180 | | - client.cookies = { "session_id": session_id } |
181 | | - |
| 172 | +async def test__get_current_officers_admin(admin_client): |
182 | 173 | # test that more info is given if logged in & with access to it |
183 | | - response = await client.get("/officers/current") |
| 174 | + response = await admin_client.get("/officers/current") |
184 | 175 | assert response.status_code == 200 |
185 | 176 | curr_officers = response.json() |
186 | 177 | assert len(curr_officers) == 3 |
187 | 178 | assert curr_officers["executive at large"]["computing_id"] is not None |
188 | 179 |
|
| 180 | +async def test__get_all_officers_admin(client): |
189 | 181 | response = await client.get("/officers/all?include_future_terms=true") |
190 | 182 | assert response.status_code == 200 |
191 | 183 | assert len(response.json()) == 9 |
|
0 commit comments