aboutsummaryrefslogtreecommitdiff
path: root/userapi/userapi_test.go
diff options
context:
space:
mode:
authorS7evinK <2353100+S7evinK@users.noreply.github.com>2022-02-16 18:55:38 +0100
committerGitHub <noreply@github.com>2022-02-16 18:55:38 +0100
commit5a39512f5f35b13adea3afc2e366e01ec73924de (patch)
treeac0e5cd6de8798e45cf0b5b37440ae08f4c7ba90 /userapi/userapi_test.go
parente9b672a34e08bce9d12b2a2454c19fde6e52036e (diff)
Add account type (#2171)
* Add account_type for sqlite3 * Add account_type for postgres * Remove CreateGuestAccount from interface * Add new AccountTypes & update test * Use newly added AccountType for account creation * Add migrations * Reuse type * Add AccounnType to Device, so it can be verified on requests * Rename migration, add missing update for appservices * Rename sqlite3 migration * Add missing AccountType to return value * Update sqlite migration Change allowance check on /admin/whois * Fix migration, add IS NULL * Move accountType to completeRegistration * Fix migrations * Add passing test
Diffstat (limited to 'userapi/userapi_test.go')
-rw-r--r--userapi/userapi_test.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/userapi/userapi_test.go b/userapi/userapi_test.go
index 266f5ed5..141dd96d 100644
--- a/userapi/userapi_test.go
+++ b/userapi/userapi_test.go
@@ -23,6 +23,9 @@ import (
"time"
"github.com/gorilla/mux"
+ "github.com/matrix-org/gomatrixserverlib"
+ "golang.org/x/crypto/bcrypt"
+
"github.com/matrix-org/dendrite/internal/httputil"
"github.com/matrix-org/dendrite/internal/test"
"github.com/matrix-org/dendrite/setup/config"
@@ -30,8 +33,6 @@ import (
"github.com/matrix-org/dendrite/userapi/inthttp"
"github.com/matrix-org/dendrite/userapi/storage/accounts"
"github.com/matrix-org/dendrite/userapi/storage/devices"
- "github.com/matrix-org/gomatrixserverlib"
- "golang.org/x/crypto/bcrypt"
)
const (
@@ -73,7 +74,7 @@ func TestQueryProfile(t *testing.T) {
aliceAvatarURL := "mxc://example.com/alice"
aliceDisplayName := "Alice"
userAPI, accountDB := MustMakeInternalAPI(t, apiTestOpts{})
- _, err := accountDB.CreateAccount(context.TODO(), "alice", "foobar", "")
+ _, err := accountDB.CreateAccount(context.TODO(), "alice", "foobar", "", api.AccountTypeUser)
if err != nil {
t.Fatalf("failed to make account: %s", err)
}
@@ -151,7 +152,7 @@ func TestLoginToken(t *testing.T) {
t.Run("tokenLoginFlow", func(t *testing.T) {
userAPI, accountDB := MustMakeInternalAPI(t, apiTestOpts{})
- _, err := accountDB.CreateAccount(ctx, "auser", "apassword", "")
+ _, err := accountDB.CreateAccount(ctx, "auser", "apassword", "", api.AccountTypeUser)
if err != nil {
t.Fatalf("failed to make account: %s", err)
}