mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-02 14:12:47 +00:00
Add roomserver tests (2/?) (#2445)
* Add invite table tests; move variable declarations * Add Membership table tests * Move variable declarations * Add PrevEvents table tests * Add Published table test * Add Redactions tests Fix bug in SQLite markRedactionValidatedSQL * PR comments, better readability for invite tests
This commit is contained in:
parent
1897e2f1c0
commit
6db08b2874
17 changed files with 517 additions and 66 deletions
|
@ -69,12 +69,12 @@ type inviteStatements struct {
|
|||
selectInvitesAboutToRetireStmt *sql.Stmt
|
||||
}
|
||||
|
||||
func createInvitesTable(db *sql.DB) error {
|
||||
func CreateInvitesTable(db *sql.DB) error {
|
||||
_, err := db.Exec(inviteSchema)
|
||||
return err
|
||||
}
|
||||
|
||||
func prepareInvitesTable(db *sql.DB) (tables.Invites, error) {
|
||||
func PrepareInvitesTable(db *sql.DB) (tables.Invites, error) {
|
||||
s := &inviteStatements{
|
||||
db: db,
|
||||
}
|
||||
|
@ -119,8 +119,8 @@ func (s *inviteStatements) UpdateInviteRetired(
|
|||
return
|
||||
}
|
||||
defer internal.CloseAndLogIfError(ctx, rows, "UpdateInviteRetired: rows.close() failed")
|
||||
var inviteEventID string
|
||||
for rows.Next() {
|
||||
var inviteEventID string
|
||||
if err = rows.Scan(&inviteEventID); err != nil {
|
||||
return
|
||||
}
|
||||
|
@ -147,9 +147,9 @@ func (s *inviteStatements) SelectInviteActiveForUserInRoom(
|
|||
defer internal.CloseAndLogIfError(ctx, rows, "selectInviteActiveForUserInRoom: rows.close() failed")
|
||||
var result []types.EventStateKeyNID
|
||||
var eventIDs []string
|
||||
var eventID string
|
||||
var senderUserNID int64
|
||||
for rows.Next() {
|
||||
var eventID string
|
||||
var senderUserNID int64
|
||||
if err := rows.Scan(&eventID, &senderUserNID); err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue