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

@ -18,4 +18,4 @@ threshold:
# package: 30
# (optional; default 0)
# The minimum total coverage project should have
total: 34
total: 33

View File

@ -24,7 +24,7 @@
},
"type": {
"type": "string",
"pattern": "^password$"
"pattern": "^(local|ldap|oidc)$"
}
}
}

View File

@ -53,7 +53,7 @@
},
"type": {
"type": "string",
"pattern": "^password$"
"pattern": "^(local|ldap|oidc)$"
}
}
},

View File

@ -125,14 +125,12 @@ INSERT INTO `user` (
`created_at`,
`updated_at`,
`name`,
`nickname`,
`email`,
`is_system`
) VALUES (
ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000),
ROUND(UNIX_TIMESTAMP(CURTIME(4)) * 1000),
"System",
"System",
"system@localhost",
TRUE
);

View File

@ -125,14 +125,12 @@ INSERT INTO "user" (
"created_at",
"updated_at",
"name",
"nickname",
"email",
"is_system"
) VALUES (
EXTRACT(EPOCH FROM TIMESTAMP '2011-05-17 10:40:28.876944') * 1000,
EXTRACT(EPOCH FROM TIMESTAMP '2011-05-17 10:40:28.876944') * 1000,
'System',
'System',
'system@localhost',
TRUE
);

View File

@ -124,14 +124,12 @@ INSERT INTO `user` (
created_at,
updated_at,
name,
nickname,
email,
is_system
) VALUES (
unixepoch() * 1000,
unixepoch() * 1000,
"System",
"System",
"system@localhost",
1
);

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,