[bugfix] Don't error when populating MovedTo if account not found (#2741)

* [bugfix] Don't error when populating MovedTo if account not found

* test the thing
This commit is contained in:
tobi 2024-03-10 11:59:55 +01:00 committed by tobi
commit 0bd95d7b71
2 changed files with 14 additions and 2 deletions

View file

@ -482,6 +482,17 @@ func (suite *AccountTestSuite) TestCountAccountPinnedNothingPinned() {
suite.Equal(pinned, 0) // This account has nothing pinned.
}
func (suite *AccountTestSuite) TestPopulateAccountWithUnknownMovedToURI() {
testAccount := &gtsmodel.Account{}
*testAccount = *suite.testAccounts["local_account_1"]
// Set test account MovedToURI to something we don't have in the database.
// We should not get an error when populating.
testAccount.MovedToURI = "https://unknown-instance.example.org/users/someone_we_dont_know"
err := suite.db.PopulateAccount(context.Background(), testAccount)
suite.NoError(err)
}
func TestAccountTestSuite(t *testing.T) {
suite.Run(t, new(AccountTestSuite))
}