Skip to content

Commit 4b383e1

Browse files
committed
Correct the test
1 parent 7fad133 commit 4b383e1

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

spec/client_spec.rb

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -948,53 +948,47 @@ def loop_times(times)
948948
end
949949

950950
it 'config test' do
951-
blocklist_name = "blocklist-#{SecureRandom.uuid}"
952-
words = %w[pretty crazy]
953-
954-
# Create blocklist
955-
response = @client.create_blocklist(blocklist_name, words)
956-
expect(response['duration']).not_to be_nil
957-
951+
newchannel = @client.channel('messaging', channel_id: 'fellowship-of-the-throne',
952+
data: { members: @fellowship_of_the_ring.map { |fellow| fellow[:id] } })
958953
# Create moderation config
959954
moderation_config = {
960-
key: "chat:team:#{@channel.id}",
955+
key: "chat:messaging:#{newchannel.id}",
961956
block_list_config: {
962957
enabled: true,
963958
rules: [
964959
{
965-
name: response['blocklist']['name'],
960+
name: 'profanity_en_2020_v1',
966961
action: 'flag'
967962
}
968963
]
969964
}
970965
}
971966
@moderation.upsert_config(moderation_config)
972-
response = @moderation.get_config("chat:team:#{@channel.id}")
973-
expect(response['config']['key']).to eq("chat:team:#{@channel.id}")
967+
response = @moderation.get_config("chat:messaging:#{newchannel.id}")
968+
expect(response['config']['key']).to eq("chat:messaging:#{newchannel.id}")
974969

975970
response = @moderation.query_configs(
976-
{ key: "chat:team:#{@channel.id}" },
971+
{ key: "chat:messaging:#{newchannel.id}" },
977972
[]
978973
)
979974
expect(response).not_to be_nil
980975

981976
# Send message that should be blocked
982-
983-
response = @channel.send_message(
984-
{ text: 'crazy game ever' },
977+
response = newchannel.send_message(
978+
{ text: 'damn' },
985979
@random_user[:id],
986980
force_moderation: true
987981
)
988982

989-
# # Verify message appears in review queue
983+
# Verify message appears in review queue
990984
queue_response = @moderation.query_review_queue(
991985
{ entity_type: 'stream:chat:v1:message' },
992986
{ created_at: -1 },
993987
limit: 1
994988
)
995989
expect(queue_response['items'][0]['entity_id']).to eq(response['message']['id'])
996990

997-
@moderation.delete_config("chat:team:#{@channel.id}")
991+
@moderation.delete_config("chat:messaging:#{newchannel.id}")
998992
end
999993
end
1000994
end

0 commit comments

Comments
 (0)