From 63f84da3e45d4e1cace427c6d30f19ba7e621618 Mon Sep 17 00:00:00 2001
From: tobi <31960611+tsmethurst@users.noreply.github.com>
Date: Fri, 29 Apr 2022 15:05:13 +0200
Subject: [chore] Inboxes for iri test (#508)
* tidy up some federation tests
* add missing license to following.go
* give zork some followers, as a treat
* test InboxesForIRI
* Go fmt
* update timeline tests
---
internal/federation/federatingdb/following.go | 18 +++++++++
internal/federation/federatingdb/inbox_test.go | 56 ++++++++++++++++++++++++++
2 files changed, 74 insertions(+)
create mode 100644 internal/federation/federatingdb/inbox_test.go
(limited to 'internal/federation/federatingdb')
diff --git a/internal/federation/federatingdb/following.go b/internal/federation/federatingdb/following.go
index 54d703742..62b148d5b 100644
--- a/internal/federation/federatingdb/following.go
+++ b/internal/federation/federatingdb/following.go
@@ -1,3 +1,21 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
package federatingdb
import (
diff --git a/internal/federation/federatingdb/inbox_test.go b/internal/federation/federatingdb/inbox_test.go
new file mode 100644
index 000000000..d5cc46b8b
--- /dev/null
+++ b/internal/federation/federatingdb/inbox_test.go
@@ -0,0 +1,56 @@
+/*
+ GoToSocial
+ Copyright (C) 2021-2022 GoToSocial Authors admin@gotosocial.org
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU Affero General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see .
+*/
+
+package federatingdb_test
+
+import (
+ "context"
+ "testing"
+
+ "github.com/stretchr/testify/suite"
+ "github.com/superseriousbusiness/gotosocial/testrig"
+)
+
+type InboxTestSuite struct {
+ FederatingDBTestSuite
+}
+
+func (suite *InboxTestSuite) TestInboxesForFollowersIRI() {
+ ctx := context.Background()
+ testAccount := suite.testAccounts["local_account_1"]
+
+ inboxIRIs, err := suite.federatingDB.InboxesForIRI(ctx, testrig.URLMustParse(testAccount.FollowersURI))
+ suite.NoError(err)
+ suite.Len(inboxIRIs, 2)
+ suite.Equal(inboxIRIs[0].String(), suite.testAccounts["local_account_2"].InboxURI)
+ suite.Equal(inboxIRIs[1].String(), suite.testAccounts["admin_account"].InboxURI)
+}
+
+func (suite *InboxTestSuite) TestInboxesForAccountIRI() {
+ ctx := context.Background()
+ testAccount := suite.testAccounts["local_account_1"]
+
+ inboxIRIs, err := suite.federatingDB.InboxesForIRI(ctx, testrig.URLMustParse(testAccount.URI))
+ suite.NoError(err)
+ suite.Len(inboxIRIs, 1)
+ suite.Equal(inboxIRIs[0].String(), testAccount.InboxURI)
+}
+
+func TestInboxTestSuite(t *testing.T) {
+ suite.Run(t, &InboxTestSuite{})
+}
--
cgit v1.3