From 06dcea056513140555eaec6eb28066b4d2400c97 Mon Sep 17 00:00:00 2001 From: Alessio Date: Wed, 21 Feb 2024 20:23:47 -0800 Subject: [PATCH] Change the integration test for links again because link preview images keep going down (upstream) --- cmd/tests.sh | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/cmd/tests.sh b/cmd/tests.sh index 63aaa40..cf21abf 100755 --- a/cmd/tests.sh +++ b/cmd/tests.sh @@ -226,29 +226,28 @@ test $(sqlite3 twitter.db "select is_private from users where handle = 'Landshar # Test tweets with URLs -tw fetch_user wrathofgnon urls_count=$(sqlite3 twitter.db "select count(*) from urls") -test "$(sqlite3 twitter.db "select * from tweets where id = 1671285062443343872")" = "" # Check it's not already there -tw fetch_tweet_only https://twitter.com/Cernovich/status/1671285062443343872 +test "$(sqlite3 twitter.db "select * from tweets where id = 1760459421291856312")" = "" # Check it's not already there +tw fetch_tweet_only https://twitter.com/zerohedge/status/1760459421291856312 urls_count_after=$(sqlite3 twitter.db "select count(*) from urls") test $urls_count_after = $(($urls_count + 1)) -test "$(sqlite3 twitter.db "select title from urls where tweet_id = 1671285062443343872")" = "Critics blast Georgia's plan to delay software updates on its voting machines" -test $(sqlite3 twitter.db "select count(*) from urls where tweet_id = 1671285062443343872") = "1" -thumbnail_name=$(sqlite3 twitter.db "select thumbnail_remote_url from urls where tweet_id = 1671285062443343872" | grep -Po "(?<=/)[\w-]+(?=\?)") +test "$(sqlite3 twitter.db "select title from urls where tweet_id = 1760459421291856312")" = "How Do Democrats & Republicans Feel About Certain US Industries" +test $(sqlite3 twitter.db "select count(*) from urls where tweet_id = 1760459421291856312") = "1" +thumbnail_name=$(sqlite3 twitter.db "select thumbnail_remote_url from urls where tweet_id = 1760459421291856312" | grep -Po "(?<=/)[\w-]+(?=\?)") test -n "$thumbnail_name" # Not testing for what the thumbnail url is because it keeps changing # Try to double-fetch it; shouldn't duplicate the URL -tw fetch_tweet_only https://twitter.com/Cernovich/status/1671285062443343872 +tw fetch_tweet_only https://twitter.com/zerohedge/status/1760459421291856312 urls_count_after_2x=$(sqlite3 twitter.db "select count(*) from urls") test $urls_count_after_2x = $urls_count_after # Download the link's preview image -test $(sqlite3 twitter.db "select is_content_downloaded from tweets where id = 1671285062443343872") = "0" -test $(sqlite3 twitter.db "select is_content_downloaded from urls where tweet_id = 1671285062443343872") = "0" +test $(sqlite3 twitter.db "select is_content_downloaded from tweets where id = 1760459421291856312") = "0" +test $(sqlite3 twitter.db "select is_content_downloaded from urls where tweet_id = 1760459421291856312") = "0" initial_link_preview_images_count=$(find link_preview_images -mindepth 2 | wc -l) -tw download_tweet_content 1671285062443343872 -test $(sqlite3 twitter.db "select is_content_downloaded from tweets where id = 1671285062443343872") = "1" -test $(sqlite3 twitter.db "select is_content_downloaded from urls where tweet_id = 1671285062443343872") = "1" +tw download_tweet_content 1760459421291856312 +test $(sqlite3 twitter.db "select is_content_downloaded from tweets where id = 1760459421291856312") = "1" +test $(sqlite3 twitter.db "select is_content_downloaded from urls where tweet_id = 1760459421291856312") = "1" test $(find link_preview_images -mindepth 2 | wc -l) = "$((initial_link_preview_images_count + 1))" find link_preview_images | grep ${thumbnail_name}\\w*.jpg