Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
rsarm committed Sep 12, 2024
1 parent 3e75b84 commit a86c548
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/test_spawner.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,25 @@ async def refresh_user(self, user, handler=None):
return {"auth_state": auth_state}


async def get_firecrest_client(spawner):
auth_state_refreshed = await spawner.user.authenticator.refresh_user(spawner.user) # noqa E501
access_token = auth_state_refreshed['auth_state']['access_token']

client = firecrest.AsyncFirecrest(
firecrest_url=spawner.firecrest_url,
authorization=FirecrestAccessTokenAuth(access_token)
)

return client


# FIXME: Setup the auth state in the unit tests
# Since the auth state is not setup for the unit tests,
# the spawner's get_firecrest_client method will fail
# when trying to get a key from a none `auth_state`
SlurmSpawner.get_firecrest_client = get_firecrest_client


def new_spawner(db, spawner_class=SlurmSpawner, **kwargs):
user = db.query(orm.User).first()
hub = Hub()
Expand Down

0 comments on commit a86c548

Please sign in to comment.