diff options
author | 2022-05-27 16:35:35 +0200 | |
---|---|---|
committer | 2022-05-27 16:35:35 +0200 | |
commit | dc8cc7e364de3342c84c2329da6a0addfcbba273 (patch) | |
tree | 2645e28ba4ba97014582075c577b011dafb79c16 /internal/federation/dereferencing/account_test.go | |
parent | [performance] Don't retry/backoff invalid http requests that will never succe... (diff) | |
download | gotosocial-dc8cc7e364de3342c84c2329da6a0addfcbba273.tar.xz |
[chore] Add test for dereferencing Owncast service account (#613)
Diffstat (limited to 'internal/federation/dereferencing/account_test.go')
-rw-r--r-- | internal/federation/dereferencing/account_test.go | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/federation/dereferencing/account_test.go b/internal/federation/dereferencing/account_test.go index cb6f9588c..75c02af75 100644 --- a/internal/federation/dereferencing/account_test.go +++ b/internal/federation/dereferencing/account_test.go @@ -51,6 +51,26 @@ func (suite *AccountTestSuite) TestDereferenceGroup() { suite.Equal(ap.ActorGroup, dbGroup.ActorType) } +func (suite *AccountTestSuite) TestDereferenceService() { + fetchingAccount := suite.testAccounts["local_account_1"] + + serviceURL := testrig.URLMustParse("https://owncast.example.org/federation/user/rgh") + service, err := suite.dereferencer.GetRemoteAccount(context.Background(), fetchingAccount.Username, serviceURL, false, false) + suite.NoError(err) + suite.NotNil(service) + suite.NotNil(service) + + // service values should be set + suite.Equal("https://owncast.example.org/federation/user/rgh", service.URI) + suite.Equal("https://owncast.example.org/federation/user/rgh", service.URL) + + // service should be in the database + dbService, err := suite.db.GetAccountByURI(context.Background(), service.URI) + suite.NoError(err) + suite.Equal(service.ID, dbService.ID) + suite.Equal(ap.ActorService, dbService.ActorType) +} + func TestAccountTestSuite(t *testing.T) { suite.Run(t, new(AccountTestSuite)) } |