mirror of
https://github.com/TwiN/gatus.git
synced 2024-11-25 01:13:40 +01:00
test(security): Make sure router behaves as intended when authn is required
This commit is contained in:
parent
6bb65f4eec
commit
0e33556775
@ -67,6 +67,30 @@ func TestNew(t *testing.T) {
|
||||
Path: "/index.html",
|
||||
ExpectedCode: fiber.StatusMovedPermanently,
|
||||
},
|
||||
{
|
||||
Name: "index-should-return-200-even-if-not-authenticated",
|
||||
Path: "/",
|
||||
ExpectedCode: fiber.StatusOK,
|
||||
WithSecurity: true,
|
||||
},
|
||||
{
|
||||
Name: "endpoints-should-return-401-if-not-authenticated",
|
||||
Path: "/api/v1/endpoints/statuses",
|
||||
ExpectedCode: fiber.StatusUnauthorized,
|
||||
WithSecurity: true,
|
||||
},
|
||||
{
|
||||
Name: "config-should-return-200-even-if-not-authenticated",
|
||||
Path: "/api/v1/config",
|
||||
ExpectedCode: fiber.StatusOK,
|
||||
WithSecurity: true,
|
||||
},
|
||||
{
|
||||
Name: "config-should-always-return-200",
|
||||
Path: "/api/v1/config",
|
||||
ExpectedCode: fiber.StatusOK,
|
||||
WithSecurity: false,
|
||||
},
|
||||
}
|
||||
for _, scenario := range scenarios {
|
||||
t.Run(scenario.Name, func(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user