Add possibility to set history_visibility and user AccountType
This commit is contained in:
parent
f41931b566
commit
379e601b57
19
test/room.go
19
test/room.go
|
@ -37,10 +37,11 @@ var (
|
|||
)
|
||||
|
||||
type Room struct {
|
||||
ID string
|
||||
Version gomatrixserverlib.RoomVersion
|
||||
preset Preset
|
||||
creator *User
|
||||
ID string
|
||||
Version gomatrixserverlib.RoomVersion
|
||||
preset Preset
|
||||
visibility string
|
||||
creator *User
|
||||
|
||||
authEvents gomatrixserverlib.AuthEvents
|
||||
currentState map[string]*gomatrixserverlib.HeaderedEvent
|
||||
|
@ -103,6 +104,10 @@ func (r *Room) insertCreateEvents(t *testing.T) {
|
|||
hisVis.HistoryVisibility = "shared"
|
||||
}
|
||||
|
||||
if r.visibility != "" {
|
||||
hisVis.HistoryVisibility = r.visibility
|
||||
}
|
||||
|
||||
r.CreateAndInsert(t, r.creator, gomatrixserverlib.MRoomCreate, map[string]interface{}{
|
||||
"creator": r.creator.ID,
|
||||
"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 {
|
||||
return func(t *testing.T, r *Room) {
|
||||
r.Version = ver
|
||||
|
|
10
test/user.go
10
test/user.go
|
@ -20,6 +20,7 @@ import (
|
|||
"sync/atomic"
|
||||
"testing"
|
||||
|
||||
"github.com/matrix-org/dendrite/userapi/api"
|
||||
"github.com/matrix-org/gomatrixserverlib"
|
||||
)
|
||||
|
||||
|
@ -45,7 +46,8 @@ var (
|
|||
)
|
||||
|
||||
type User struct {
|
||||
ID string
|
||||
ID string
|
||||
accountType api.AccountType
|
||||
// key ID and private key of the server who has this user, if known.
|
||||
keyID gomatrixserverlib.KeyID
|
||||
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 {
|
||||
counter := atomic.AddInt64(&userIDCounter, 1)
|
||||
var u User
|
||||
|
|
Loading…
Reference in a new issue