Skip to content

Commit

Permalink
CV2-3582: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
melsawy authored and jayjay-w committed Mar 28, 2024
1 parent 85263a1 commit 0f0174b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion app/models/concerns/smooch_blocking.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ def apply_content_warning_to_user_content(uid)
ProjectMedia.joins(:tipline_requests)
.where(tipline_requests: { tipline_user_uid: uid }).find_each do |pm|
flags = { 'spam': 1, 'adult': 0, 'spoof': 0, 'medical': 0, 'violence': 0, 'racy': 0 }
Dynamic.create!(annotation_type: 'flag', annotated: pm, annotator: User.current, skip_check_ability: true, set_fields: { show_cover: true, flags: flags }.to_json)
# Add a flag
flag = Dynamic.new
flag.annotation_type = 'flag'
flag.annotated = pm
flag.skip_check_ability = true
flag.set_fields = { show_cover: true, flags: flags }.to_json
flag.save!
end
RequestStore.store[:skip_rules] = false
end
Expand Down
1 change: 1 addition & 0 deletions test/models/bot/smooch_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ def aasm(_arg)
end

test "should ban user that sends unsafe URL" do
create_flag_annotation_type
uid = random_string
url = 'http://unsafe.com/'
pender_url = CheckConfig.get('pender_url_private') + '/api/medias'
Expand Down
3 changes: 1 addition & 2 deletions test/models/bot/smooch_6_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -698,9 +698,8 @@ def send_message_outside_24_hours_window(template, pm = nil)
end

test "should not reply to banned user" do
create_flag_annotation_type
Sidekiq::Worker.clear_all
Bot::Smooch.ban_user({ 'authorId' => @uid })
Sidekiq::Worker.clear_all
Sidekiq::Testing.fake! do
send_message 'hello'
assert_equal 0, Sidekiq::Worker.jobs.size
Expand Down

0 comments on commit 0f0174b

Please sign in to comment.