Skip to content

Commit

Permalink
fix broken test with proper query events
Browse files Browse the repository at this point in the history
  • Loading branch information
DGaffney committed May 8, 2024
1 parent 62c0397 commit 5ebc101
Showing 1 changed file with 50 additions and 1 deletion.
51 changes: 50 additions & 1 deletion test/models/bot/alegre_v2_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -847,7 +847,7 @@ def teardown
"temporary_media": false,
},
"url": "http://minio:9000/check-api-dev/uploads/uploaded_image/55/09572dedf610aad68090214303c14829.png",
"threshold": 0.73,
"threshold": 0.85,
"confirmed": true,
"created_at": "2024-03-14T22:05:47.588975",
"limit": 200,
Expand Down Expand Up @@ -878,8 +878,57 @@ def teardown
}
}
}
unconfirmed_params = {
"model_type": "image",
"data": {
"is_shortcircuited_search_result_callback": true,
"item": {
"callback_url": "http://alegre:3100/presto/receive/add_item/image",
"url": "http://minio:9000/check-api-dev/uploads/uploaded_image/55/09572dedf610aad68090214303c14829.png",
"text": nil,
"raw": {
"doc_id": "Y2hlY2stcHJvamVjdF9tZWRpYS0yMTQt",
"context": {
"team_id": pm1.team_id,
"project_media_id": pm1.id,
"has_custom_id": true,
"temporary_media": false,
},
"url": "http://minio:9000/check-api-dev/uploads/uploaded_image/55/09572dedf610aad68090214303c14829.png",
"threshold": 0.73,
"confirmed": false,
"created_at": "2024-03-14T22:05:47.588975",
"limit": 200,
"requires_callback": true,
"final_task": "search"
},
"hash_value": "1110101010001011110100000011110010101000000010110101101010100101101111110101101001011010100001011111110101011010010000101010010110101101010110100000001010100101101010111110101000010101011100001110101010101111100001010101001011101010101011010001010101010010"
},
"results": {
"result": [
{
"id": "Y2hlY2stcHJvamVjdF9tZWRpYS0yMTQt",
"doc_id": "Y2hlY2stcHJvamVjdF9tZWRpYS0yMTQt",
"pdq": "1110101010001011110100000011110010101000000010110101101010100101101111110101101001011010100001011111110101011010010000101010010110101101010110100000001010100101101010111110101000010101011100001110101010101111100001010101001011101010101011010001010101010010",
"url": "http://minio:9000/check-api-dev/uploads/uploaded_image/55/09572dedf610aad68090214303c14829.png",
"context": [
{
"team_id": pm2.team_id,
"has_custom_id": true,
"project_media_id": pm2.id,
"temporary_media": false,
}
],
"score": 1.0,
"model": "image/pdq"
}
]
}
}
}
assert_difference 'Relationship.count' do
# Simulate the webhook hitting the server and being executed....
Bot::Alegre.process_alegre_callback(JSON.parse(unconfirmed_params.to_json)) #hack to force into stringed keys
relationship = Bot::Alegre.process_alegre_callback(JSON.parse(params.to_json)) #hack to force into stringed keys
end
assert_equal relationship.source, pm2
Expand Down

0 comments on commit 5ebc101

Please sign in to comment.