Skip to content

Commit

Permalink
linting
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyorlando committed Aug 8, 2024
1 parent 1719cf7 commit 8493265
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions engine/apps/slack/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ class SlackAPIUsergroupPaidTeamOnlyError(SlackAPIError):
https://api.slack.com/methods/usergroups.create#:~:text=Name%20too%20long.-,paid_teams_only,-Usergroups%20can%20only
https://slack.com/help/articles/212906697-Create-a-user-group
"""

errors = ("paid_teams_only",)


Expand Down
4 changes: 3 additions & 1 deletion engine/apps/slack/models/slack_usergroup.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@ def can_be_updated(self) -> bool:

@property
def oncall_slack_user_identities(self) -> list[SlackUserIdentity]:
users: set[User] = set(user for schedule in self.oncall_schedules.get_oncall_users().values() for user in schedule)
users: set[User] = set(
user for schedule in self.oncall_schedules.get_oncall_users().values() for user in schedule
)
slack_user_identities: list[SlackUserIdentity] = []
for user in users:
if user.slack_user_identity is not None:
Expand Down
23 changes: 11 additions & 12 deletions engine/apps/slack/tests/test_user_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,15 @@ def test_update_members(make_organization_with_slack_team_identity, make_slack_u


@pytest.mark.django_db
@pytest.mark.parametrize("exception", [
SlackAPITokenError,
SlackAPIUsergroupNotFoundError,
SlackAPIInvalidUsersError,
SlackAPIUsergroupPaidTeamOnlyError,
])
@pytest.mark.parametrize(
"exception",
[
SlackAPITokenError,
SlackAPIUsergroupNotFoundError,
SlackAPIInvalidUsersError,
SlackAPIUsergroupPaidTeamOnlyError,
],
)
def test_slack_user_group_update_errors(
make_organization_with_slack_team_identity,
make_slack_user_group,
Expand Down Expand Up @@ -232,12 +235,8 @@ def test_get_users_from_members_for_organization(
):
organization, slack_team_identity = make_organization_with_slack_team_identity()

user_1, _ = make_user_with_slack_user_identity(
slack_team_identity, organization, slack_id="slack_id_1"
)
user_2, _ = make_user_with_slack_user_identity(
slack_team_identity, organization, slack_id="slack_id_2"
)
user_1, _ = make_user_with_slack_user_identity(slack_team_identity, organization, slack_id="slack_id_1")
user_2, _ = make_user_with_slack_user_identity(slack_team_identity, organization, slack_id="slack_id_2")
user_group = make_slack_user_group(slack_team_identity)
user_group.members = ["slack_id_1", "slack_id_2"]
user_group.save(update_fields=["members"])
Expand Down

0 comments on commit 8493265

Please sign in to comment.