CI stack for Authentik with ldap

This commit is contained in:
Jamie Curnow
2024-11-03 13:17:24 +10:00
parent a277a5d167
commit 6e820a36ac
35 changed files with 116 additions and 172 deletions

View File

@ -97,13 +97,14 @@ func (s *testsuite) TestSave() {
defer goleak.VerifyNone(s.T(), goleak.IgnoreAnyFunction("database/sql.(*DB).connectionOpener"))
s.mock.ExpectBegin()
s.mock.ExpectQuery(regexp.QuoteMeta(`INSERT INTO "auth" ("created_at","updated_at","is_deleted","user_id","type","secret") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "id"`)).
s.mock.ExpectQuery(regexp.QuoteMeta(`INSERT INTO "auth" ("created_at","updated_at","is_deleted","user_id","type","identity","secret") VALUES ($1,$2,$3,$4,$5,$6,$7) RETURNING "id"`)).
WithArgs(
sqlmock.AnyArg(),
sqlmock.AnyArg(),
0,
100,
TypeLocal,
"",
"abc123",
).
WillReturnRows(sqlmock.NewRows([]string{"id"}).AddRow("11"))

View File

@ -39,7 +39,6 @@ func (m *Model) LoadByID(id int) error {
// Save will save this model to the DB
func (m *Model) Save() error {
db := database.GetDB()
// todo: touch? not sure that save does this or not?
result := db.Save(m)
return result.Error
}

View File

@ -84,7 +84,6 @@ func (s *testsuite) SetupTest() {
).AddRow(
11,
"Jane Doe",
"Jane",
"jane@example.com",
true,
false,
@ -183,7 +182,6 @@ func (s *testsuite) TestSave() {
sqlmock.AnyArg(),
0,
"John Doe",
"Jonny",
"sarah@example.com",
false,
false,