mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-01-31 08:04:28 -06:00
Add possibility to set history_visibility and user AccountType
This commit is contained in:
parent
f41931b566
commit
379e601b57
11
test/room.go
11
test/room.go
|
@ -40,6 +40,7 @@ type Room struct {
|
||||||
ID string
|
ID string
|
||||||
Version gomatrixserverlib.RoomVersion
|
Version gomatrixserverlib.RoomVersion
|
||||||
preset Preset
|
preset Preset
|
||||||
|
visibility string
|
||||||
creator *User
|
creator *User
|
||||||
|
|
||||||
authEvents gomatrixserverlib.AuthEvents
|
authEvents gomatrixserverlib.AuthEvents
|
||||||
|
@ -103,6 +104,10 @@ func (r *Room) insertCreateEvents(t *testing.T) {
|
||||||
hisVis.HistoryVisibility = "shared"
|
hisVis.HistoryVisibility = "shared"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if r.visibility != "" {
|
||||||
|
hisVis.HistoryVisibility = r.visibility
|
||||||
|
}
|
||||||
|
|
||||||
r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomCreate, map[string]interface{}{
|
r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomCreate, map[string]interface{}{
|
||||||
"creator": r.creator.ID,
|
"creator": r.creator.ID,
|
||||||
"room_version": r.Version,
|
"room_version": r.Version,
|
||||||
|
@ -242,6 +247,12 @@ func RoomPreset(p Preset) roomModifier {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func RoomHistoryVisibility(vis string) roomModifier {
|
||||||
|
return func(t *testing.T, r *Room) {
|
||||||
|
r.visibility = vis
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func RoomVersion(ver gomatrixserverlib.RoomVersion) roomModifier {
|
func RoomVersion(ver gomatrixserverlib.RoomVersion) roomModifier {
|
||||||
return func(t *testing.T, r *Room) {
|
return func(t *testing.T, r *Room) {
|
||||||
r.Version = ver
|
r.Version = ver
|
||||||
|
|
|
@ -20,6 +20,7 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
"github.com/matrix-org/dendrite/userapi/api"
|
||||||
"github.com/matrix-org/gomatrixserverlib"
|
"github.com/matrix-org/gomatrixserverlib"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ var (
|
||||||
|
|
||||||
type User struct {
|
type User struct {
|
||||||
ID string
|
ID string
|
||||||
|
accountType api.AccountType
|
||||||
// key ID and private key of the server who has this user, if known.
|
// key ID and private key of the server who has this user, if known.
|
||||||
keyID gomatrixserverlib.KeyID
|
keyID gomatrixserverlib.KeyID
|
||||||
privKey ed25519.PrivateKey
|
privKey ed25519.PrivateKey
|
||||||
|
@ -62,6 +64,12 @@ func WithSigningServer(srvName gomatrixserverlib.ServerName, keyID gomatrixserve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func WithAccountType(accountType api.AccountType) UserOpt {
|
||||||
|
return func(u *User) {
|
||||||
|
u.accountType = accountType
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func NewUser(t *testing.T, opts ...UserOpt) *User {
|
func NewUser(t *testing.T, opts ...UserOpt) *User {
|
||||||
counter := atomic.AddInt64(&userIDCounter, 1)
|
counter := atomic.AddInt64(&userIDCounter, 1)
|
||||||
var u User
|
var u User
|
||||||
|
|
Loading…
Reference in a new issue