mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
a4cf2e675f
* it doesn't work with our current CSP * it's probably not used by anyone * it isn't in harmony with our security purposes * literally removes all use of it * suggestions from code review * remove useless test. Co-authored-by: Amir Zarrinkafsh <nightah@me.com> Co-authored-by: Clement Michaud <clement.michaud34@gmail.com>
54 lines
1.2 KiB
Go
54 lines
1.2 KiB
Go
package handlers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/suite"
|
|
|
|
"github.com/authelia/authelia/internal/mocks"
|
|
"github.com/authelia/authelia/internal/session"
|
|
)
|
|
|
|
type ConfigurationSuite struct {
|
|
suite.Suite
|
|
|
|
mock *mocks.MockAutheliaCtx
|
|
}
|
|
|
|
func (s *ConfigurationSuite) SetupTest() {
|
|
s.mock = mocks.NewMockAutheliaCtx(s.T())
|
|
}
|
|
|
|
func (s *ConfigurationSuite) TearDownTest() {
|
|
s.mock.Close()
|
|
}
|
|
|
|
func (s *ConfigurationSuite) TestShouldDisableRememberMe() {
|
|
s.mock.Ctx.Configuration.Session.RememberMeDuration = "0"
|
|
s.mock.Ctx.Providers.SessionProvider = session.NewProvider(
|
|
s.mock.Ctx.Configuration.Session)
|
|
expectedBody := ConfigurationBody{
|
|
RememberMe: false,
|
|
ResetPassword: true,
|
|
}
|
|
|
|
ConfigurationGet(s.mock.Ctx)
|
|
s.mock.Assert200OK(s.T(), expectedBody)
|
|
}
|
|
|
|
func (s *ConfigurationSuite) TestShouldDisableResetPassword() {
|
|
s.mock.Ctx.Configuration.AuthenticationBackend.DisableResetPassword = true
|
|
expectedBody := ConfigurationBody{
|
|
RememberMe: true,
|
|
ResetPassword: false,
|
|
}
|
|
|
|
ConfigurationGet(s.mock.Ctx)
|
|
s.mock.Assert200OK(s.T(), expectedBody)
|
|
}
|
|
|
|
func TestRunHandlerConfigurationSuite(t *testing.T) {
|
|
s := new(ConfigurationSuite)
|
|
suite.Run(t, s)
|
|
}
|