diff options
author | 2022-12-01 16:06:09 +0100 | |
---|---|---|
committer | 2022-12-01 16:06:09 +0100 | |
commit | cf20397f261becaf84d4d3e3f6620d1366b34131 (patch) | |
tree | dc46e3a337b2606b01856211d40c196cb03c41d4 /internal/db/bundb/account_test.go | |
parent | [feature] Support PKCS1 "RSA PUBLIC KEY" pem block type (#1179) (diff) | |
download | gotosocial-cf20397f261becaf84d4d3e3f6620d1366b34131.tar.xz |
[bugfix] Use case-insensitive selects when getting remote accounts by username/domain (#1191)v0.6.0-rc2
* [bugfix] Case-insensitive account selection
* don't lowercase cache key
Diffstat (limited to 'internal/db/bundb/account_test.go')
-rw-r--r-- | internal/db/bundb/account_test.go | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/internal/db/bundb/account_test.go b/internal/db/bundb/account_test.go index 50603623f..bf85f14f4 100644 --- a/internal/db/bundb/account_test.go +++ b/internal/db/bundb/account_test.go @@ -22,6 +22,7 @@ import ( "context" "crypto/rand" "crypto/rsa" + "strings" "testing" "time" @@ -84,6 +85,22 @@ func (suite *AccountTestSuite) TestGetAccountByUsernameDomain() { suite.NotNil(account2) } +func (suite *AccountTestSuite) TestGetAccountByUsernameDomainMixedCase() { + testAccount := suite.testAccounts["remote_account_2"] + + account1, err := suite.db.GetAccountByUsernameDomain(context.Background(), testAccount.Username, testAccount.Domain) + suite.NoError(err) + suite.NotNil(account1) + + account2, err := suite.db.GetAccountByUsernameDomain(context.Background(), strings.ToUpper(testAccount.Username), testAccount.Domain) + suite.NoError(err) + suite.NotNil(account2) + + account3, err := suite.db.GetAccountByUsernameDomain(context.Background(), strings.ToLower(testAccount.Username), testAccount.Domain) + suite.NoError(err) + suite.NotNil(account3) +} + func (suite *AccountTestSuite) TestUpdateAccount() { ctx := context.Background() |