From 4cf5664ccd4d2ec725d9aeadc111d15253a60e86 Mon Sep 17 00:00:00 2001 From: manu vasconcelos Date: Fri, 13 Dec 2024 13:08:36 -0300 Subject: [PATCH] WIP: write failing test test does not fail :( --- test/models/bot/smooch_7_test.rb | 47 ++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/test/models/bot/smooch_7_test.rb b/test/models/bot/smooch_7_test.rb index 10217674c..a518effd8 100644 --- a/test/models/bot/smooch_7_test.rb +++ b/test/models/bot/smooch_7_test.rb @@ -632,4 +632,51 @@ def teardown end TiplineRequest.any_instance.unstub(:save!) end + + test "should not create relationship between media and tipline resource" do + author = BotUser.smooch_user + same_id = random_number + + t2 = create_team + pm = create_project_media team: t2 + pm.update_column(:id, same_id) + puts pm.id + + t = create_team + tipline_resource = create_tipline_resource team: t + tipline_resource.update_column(:id, same_id) + puts tipline_resource.id + + Sidekiq::Testing.inline! do + # message = { + # type: 'video', + # text: 'Something long enough to be considered a media', + # caption: 'I have a caption!', + # # role: 'appUser', + # # received: 1573082583.219, + # # name: random_string, + # # authorId: random_string, + # # '_id': random_string, + # source: { + # # originalMessageId: random_string, + # # originalMessageTimestamp: 1573082582, + # type: 'whatsapp', + # # integrationId: random_string + # }, + # language: 'en', + # } + message = { + type: 'video', + source: { type: "whatsapp" }, + # text: 'Something long enough to be considered a media', + text: 'Something short', + # caption: 'Something long enough to be considered a media', + caption: 'Something short', + mediaUrl: @video_url, + '_id': random_string, + language: 'en', + } + Bot::Smooch.save_message(message.to_json, @app_id, author, 'resource_requests', tipline_resource.id, 'TiplineResource') + end + end end