diff --git a/cmd/tests.sh b/cmd/tests.sh index 81f4445..a52e396 100755 --- a/cmd/tests.sh +++ b/cmd/tests.sh @@ -349,6 +349,11 @@ test $(sqlite3 twitter.db "select is_stub, user_id = 0x4000000000000000 from twe tw fetch_user nancytracker test "$(sqlite3 twitter.db "select is_banned from users where handle='nancytracker'")" = "1" +# Fetch a thread with a banned user in it; test no-clobbering of the existing user data +sqlite3 twitter.db "insert into users (id, handle, display_name, profile_image_url, banner_image_local_path, followers_count) values (1595500307374829568, 'spandrell3', 'Spandrell', 'Profile URL', 'Banner Local', 10)" +tw fetch_tweet https://twitter.com/spandrell3/status/1709580398026805736 +test "$(sqlite3 twitter.db "select display_name, profile_image_url, banner_image_local_path, followers_count, is_banned from users where handle='spandrell3'")" = "Spandrell|Profile URL|Banner Local|10|1" + # Fetch a user with "600x200" banner image tw fetch_user AlexKoppelman # This is probably kind of a flimsy test diff --git a/pkg/scraper/api_types_v2_test.go b/pkg/scraper/api_types_v2_test.go index 09e90e0..da4e011 100644 --- a/pkg/scraper/api_types_v2_test.go +++ b/pkg/scraper/api_types_v2_test.go @@ -1040,7 +1040,6 @@ func TestParseTweetThreadWithBannedUser(t *testing.T) { assert.Equal(banned_tweet2.UserID, UserID(1595500307374829568)) assert.Equal(banned_tweet2.TombstoneType, "suspended") - // assert.Len(trove.Users, 3) banned_user, is_ok := trove.Users[1595500307374829568] assert.True(is_ok) assert.Equal(banned_user.Handle, UserHandle("spandrell3"))