Skip to content

Commit

Permalink
revert back to async
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Aug 21, 2024
1 parent 90c88ee commit 5ae5aa5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions test/models/bot/smooch_6_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def send_message_outside_24_hours_window(template, pm = nil)

test "should submit query without details on tipline bot v2" do
WebMock.stub_request(:post, /\/text\/similarity\/search\//).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/sync\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/async\/text/).to_return(body: {}.to_json) # For explainers
claim = 'This is a test claim'
send_message 'hello', '1', '1', random_string, random_string, claim, random_string, random_string, '1'
assert_saved_query_type 'default_requests'
Expand Down Expand Up @@ -209,7 +209,7 @@ def send_message_outside_24_hours_window(template, pm = nil)
end

test "should submit query with details on tipline bot v2" do
WebMock.stub_request(:post, /\/similarity\/sync\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/async\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/text\/similarity\/search\//).to_return(body: {}.to_json) # For explainers
claim = 'This is a test claim'
send_message 'hello', '1', '1', random_string, '2', random_string, claim, '1'
Expand Down Expand Up @@ -287,7 +287,7 @@ def send_message_outside_24_hours_window(template, pm = nil)
end

test "should submit query and handle search error on tipline bot v2" do
WebMock.stub_request(:post, /\/similarity\/sync\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/async\/text/).to_return(body: {}.to_json) # For explainers
CheckSearch.any_instance.stubs(:medias).raises(StandardError)
Sidekiq::Testing.inline! do
send_message 'hello', '1', '1', 'Foo bar', '1'
Expand Down Expand Up @@ -386,7 +386,7 @@ def send_message_outside_24_hours_window(template, pm = nil)
ProjectMedia.any_instance.stubs(:report_status).returns('published')
ProjectMedia.any_instance.stubs(:analysis_published_article_url).returns(random_url)
Bot::Alegre.stubs(:get_merged_similar_items).returns({ create_project_media.id => { score: 0.9 } })
WebMock.stub_request(:post, /\/similarity\/sync\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/async\/text/).to_return(body: {}.to_json) # For explainers
Sidekiq::Testing.inline! do
send_message 'hello', '1', '1', "Foo bar foo bar #{url} foo bar", '1'
end
Expand Down
4 changes: 2 additions & 2 deletions test/models/explainer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,12 @@ def setup
}

# Index two paragraphs and title when the explainer is created
Bot::Alegre.stubs(:request).with('post', '/similarity/sync/text', anything).times(3)
Bot::Alegre.stubs(:request).with('post', '/similarity/async/text', anything).times(3)
Bot::Alegre.stubs(:request).with('delete', '/text/similarity/', anything).never
ex = create_explainer description: description

# Update the index when paragraphs change
Bot::Alegre.stubs(:request).with('post', '/similarity/sync/text', anything).times(2)
Bot::Alegre.stubs(:request).with('post', '/similarity/async/text', anything).times(2)
Bot::Alegre.stubs(:request).with('delete', '/text/similarity/', anything).once
ex = Explainer.find(ex.id)
ex.description = 'Now this is the only paragraph'
Expand Down

0 comments on commit 5ae5aa5

Please sign in to comment.