Add integration test for no-clobbering banned users

This commit is contained in:
Alessio 2025-02-17 18:39:01 -08:00
parent 1e09477a5e
commit 43566b4613
2 changed files with 5 additions and 1 deletions

View File

@ -349,6 +349,11 @@ test $(sqlite3 twitter.db "select is_stub, user_id = 0x4000000000000000 from twe
tw fetch_user nancytracker tw fetch_user nancytracker
test "$(sqlite3 twitter.db "select is_banned from users where handle='nancytracker'")" = "1" 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 # Fetch a user with "600x200" banner image
tw fetch_user AlexKoppelman # This is probably kind of a flimsy test tw fetch_user AlexKoppelman # This is probably kind of a flimsy test

View File

@ -1040,7 +1040,6 @@ func TestParseTweetThreadWithBannedUser(t *testing.T) {
assert.Equal(banned_tweet2.UserID, UserID(1595500307374829568)) assert.Equal(banned_tweet2.UserID, UserID(1595500307374829568))
assert.Equal(banned_tweet2.TombstoneType, "suspended") assert.Equal(banned_tweet2.TombstoneType, "suspended")
// assert.Len(trove.Users, 3)
banned_user, is_ok := trove.Users[1595500307374829568] banned_user, is_ok := trove.Users[1595500307374829568]
assert.True(is_ok) assert.True(is_ok)
assert.Equal(banned_user.Handle, UserHandle("spandrell3")) assert.Equal(banned_user.Handle, UserHandle("spandrell3"))