From a001d68be7128c3f65fd15bbb81a8522afa4eeeb Mon Sep 17 00:00:00 2001 From: Suejung Shin Date: Wed, 29 Jan 2025 16:02:22 -0800 Subject: [PATCH] cleanup --- tasks/sync_teams.py | 6 ++++-- tasks/tests/unit/test_sync_teams_task.py | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/tasks/sync_teams.py b/tasks/sync_teams.py index 95992ad82..11c80d80e 100644 --- a/tasks/sync_teams.py +++ b/tasks/sync_teams.py @@ -59,11 +59,13 @@ def run_impl(self, db_session, ownerid, *, username=None, **kwargs): ), ) for org_ownerid in removed_orgs: - org = db_session.query(Owner).filter(Owner.ownerid == org_ownerid).first() + org = ( + db_session.query(Owner).filter(Owner.ownerid == org_ownerid).first() + ) if org and ownerid in org.plan_activated_users: log.info( "Removing user from org's plan_activated_users", - extra=dict(user_ownerid=ownerid, org_ownerid=org_ownerid) + extra=dict(user_ownerid=ownerid, org_ownerid=org_ownerid), ) org.plan_activated_users.remove(ownerid) diff --git a/tasks/tests/unit/test_sync_teams_task.py b/tasks/tests/unit/test_sync_teams_task.py index cfed4ac47..b85455bc8 100644 --- a/tasks/tests/unit/test_sync_teams_task.py +++ b/tasks/tests/unit/test_sync_teams_task.py @@ -39,6 +39,7 @@ def test_team_removed(self, mocker, mock_configuration, dbsession, codecov_vcr): ) prev_team.plan_activated_users = [user.ownerid] dbsession.add(user) + dbsession.add(prev_team) dbsession.flush() SyncTeamsTask().run_impl(dbsession, user.ownerid, using_integration=False) assert prev_team.ownerid not in user.organizations