summaryrefslogtreecommitdiff
path: root/internal/federation/dereferencing/account_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/federation/dereferencing/account_test.go')
-rw-r--r--internal/federation/dereferencing/account_test.go20
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))
}