Skip to content

Commit

Permalink
update more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyorlando committed Nov 2, 2024
1 parent 4920f56 commit 066e8cd
Showing 1 changed file with 18 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ def test_save_thread_message_for_resolution_note_really_long_text(
make_alert_receive_channel,
make_alert_group,
make_slack_message,
make_slack_channel,
) -> None:
(
organization,
Expand All @@ -229,11 +230,13 @@ def test_save_thread_message_for_resolution_note_really_long_text(
integration = make_alert_receive_channel(organization)
alert_group = make_alert_group(integration)

channel = "potato"
ts = 88945.4849
thread_ts = 16789.123

make_slack_message(alert_group, slack_id=thread_ts, channel_id=channel)
slack_channel = make_slack_channel(slack_team_identity)
slack_channel_id = slack_channel.slack_id

make_slack_message(alert_group, slack_id=thread_ts, channel_id=slack_channel_id)

mock_permalink = "http://example.com"

Expand All @@ -243,7 +246,7 @@ def test_save_thread_message_for_resolution_note_really_long_text(

payload = {
"event": {
"channel": channel,
"channel": slack_channel_id,
"ts": ts,
"thread_ts": thread_ts,
"text": "h" * 2901,
Expand Down Expand Up @@ -272,6 +275,7 @@ def test_save_thread_message_for_resolution_note_api_errors(
make_alert_receive_channel,
make_alert_group,
make_slack_message,
make_slack_channel,
) -> None:
(
organization,
Expand All @@ -282,11 +286,13 @@ def test_save_thread_message_for_resolution_note_api_errors(
integration = make_alert_receive_channel(organization)
alert_group = make_alert_group(integration)

channel = "potato"
ts = 88945.4849
thread_ts = 16789.123

make_slack_message(alert_group, slack_id=thread_ts, channel_id=channel)
slack_channel = make_slack_channel(slack_team_identity)
slack_channel_id = slack_channel.slack_id

make_slack_message(alert_group, slack_id=thread_ts, channel_id=slack_channel_id)

step = SlackChannelMessageEventStep(slack_team_identity, organization, user)
step._slack_client = Mock()
Expand All @@ -296,7 +302,7 @@ def test_save_thread_message_for_resolution_note_api_errors(

payload = {
"event": {
"channel": channel,
"channel": slack_channel_id,
"ts": ts,
"thread_ts": thread_ts,
"text": "h" * 2901,
Expand All @@ -318,6 +324,7 @@ def test_save_thread_message_for_resolution_note(
make_alert_receive_channel,
make_alert_group,
make_slack_message,
make_slack_channel,
make_resolution_note_slack_message,
resolution_note_slack_message_already_exists,
) -> None:
Expand All @@ -332,12 +339,13 @@ def test_save_thread_message_for_resolution_note(

original_text = "original text"
new_text = "new text"

channel = "potato"
ts = 88945.4849
thread_ts = 16789.123

make_slack_message(alert_group, slack_id=thread_ts, channel_id=channel)
slack_channel = make_slack_channel(slack_team_identity)
slack_channel_id = slack_channel.slack_id

make_slack_message(alert_group, slack_id=thread_ts, channel_id=slack_channel_id)

resolution_note_slack_message = None
if resolution_note_slack_message_already_exists:
Expand All @@ -353,7 +361,7 @@ def test_save_thread_message_for_resolution_note(

payload = {
"event": {
"channel": channel,
"channel": slack_channel_id,
"ts": ts,
"thread_ts": thread_ts,
"text": new_text,
Expand Down

0 comments on commit 066e8cd

Please sign in to comment.