Skip to content

Commit

Permalink
review and resolve broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed Sep 5, 2024
1 parent 03efd22 commit b5436d9
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion test/models/bot/alegre_2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ def teardown
WebMock.stub_request(:post, 'http://alegre.test/text/similarity/').to_return(body: 'success')
WebMock.stub_request(:delete, 'http://alegre.test/text/similarity/').to_return(body: { success: true }.to_json)
WebMock.stub_request(:delete, 'http://alegre.test/image/similarity/').to_return(body: { success: true }.to_json)
WebMock.stub_request(:post, 'http://alegre.test/text/similarity/search/').to_return(body: { success: true }.to_json)
WebMock.stub_request(:post, 'http://alegre.test/similarity/sync/text').to_return(body: { success: true }.to_json)
WebMock.stub_request(:post, 'http://alegre.test/image/ocr/').to_return(body: { text: 'Foo bar' }.to_json)
WebMock.stub_request(:post, 'http://alegre.test/similarity/sync/image').to_return(body: {
result: [
Expand Down
2 changes: 1 addition & 1 deletion test/models/bot/alegre_3_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def teardown
WebMock.disable_net_connect! allow: /#{CheckConfig.get('elasticsearch_host')}|#{CheckConfig.get('storage_endpoint')}/
WebMock.stub_request(:post, 'http://alegre/text/similarity/').to_return(body: 'success')
WebMock.stub_request(:delete, 'http://alegre/text/similarity/').to_return(body: {success: true}.to_json)
WebMock.stub_request(:post, 'http://alegre/text/similarity/search/').to_return(body: {success: true}.to_json)
WebMock.stub_request(:post, 'http://alegre/similarity/sync/text').to_return(body: {success: true}.to_json)
WebMock.stub_request(:post, 'http://alegre/audio/similarity/').to_return(body: {
"success": true
}.to_json)
Expand Down
2 changes: 1 addition & 1 deletion test/models/bot/alegre_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def teardown
WebMock.stub_request(:post, 'http://alegre/text/langid/').to_return(body: 'bad JSON response')
WebMock.stub_request(:post, 'http://alegre/text/langid/').to_return(body: 'bad JSON response')
WebMock.stub_request(:post, 'http://alegre/text/similarity/').to_return(body: 'success')
WebMock.stub_request(:post, 'http://alegre/text/similarity/search/').to_return(body: 'success')
WebMock.stub_request(:post, 'http://alegre/similarity/sync/text').to_return(body: 'success')
WebMock.disable_net_connect! allow: /#{CheckConfig.get('elasticsearch_host')}|#{CheckConfig.get('storage_endpoint')}/
Bot::Alegre.any_instance.stubs(:get_language).raises(RuntimeError)
assert_nothing_raised do
Expand Down
2 changes: 2 additions & 0 deletions test/models/bot/smooch_6_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,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\/async\/text/).to_return(body: {}.to_json) # For explainers
WebMock.stub_request(:post, /\/similarity\/sync\/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,6 +210,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'
Expand Down
1 change: 1 addition & 0 deletions test/models/explainer_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def setup
end

test "should create tag texts when setting tags" do
WebMock.stub_request(:post, /\/similarity\/async\/text/).to_return(body: {}.to_json) # For explainers
Sidekiq::Testing.inline! do
assert_difference 'TagText.count' do
create_explainer tags: ['foo']
Expand Down

0 comments on commit b5436d9

Please sign in to comment.