summaryrefslogtreecommitdiff
path: root/internal/db/bundb/account_test.go
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2022-08-20 22:47:19 +0200
committerLibravatar GitHub <noreply@github.com>2022-08-20 21:47:19 +0100
commit570fa7c3598118ded6df7ced0a5326f54e7a43e2 (patch)
tree9575a6f3016c73b7109c88f68a2a512981cf19e4 /internal/db/bundb/account_test.go
parent[docs] Textual updates on markdown files (#756) (diff)
downloadgotosocial-570fa7c3598118ded6df7ced0a5326f54e7a43e2.tar.xz
[bugfix] Fix potential dereference of accounts on own instance (#757)
* add GetAccountByUsernameDomain * simplify search * add escape to not deref accounts on own domain * check if local + we have account by ap uri
Diffstat (limited to 'internal/db/bundb/account_test.go')
-rw-r--r--internal/db/bundb/account_test.go12
1 files changed, 12 insertions, 0 deletions
diff --git a/internal/db/bundb/account_test.go b/internal/db/bundb/account_test.go
index 59b51386d..3c19e84d9 100644
--- a/internal/db/bundb/account_test.go
+++ b/internal/db/bundb/account_test.go
@@ -58,6 +58,18 @@ func (suite *AccountTestSuite) TestGetAccountByIDWithExtras() {
suite.NotEmpty(account.HeaderMediaAttachment.URL)
}
+func (suite *AccountTestSuite) TestGetAccountByUsernameDomain() {
+ testAccount1 := suite.testAccounts["local_account_1"]
+ account1, err := suite.db.GetAccountByUsernameDomain(context.Background(), testAccount1.Username, testAccount1.Domain)
+ suite.NoError(err)
+ suite.NotNil(account1)
+
+ testAccount2 := suite.testAccounts["remote_account_1"]
+ account2, err := suite.db.GetAccountByUsernameDomain(context.Background(), testAccount2.Username, testAccount2.Domain)
+ suite.NoError(err)
+ suite.NotNil(account2)
+}
+
func (suite *AccountTestSuite) TestUpdateAccount() {
testAccount := suite.testAccounts["local_account_1"]