mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
fabb76754e
Also fix references from config.yml to configuration.yml
48 lines
1.2 KiB
Go
48 lines
1.2 KiB
Go
package handlers
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/authelia/authelia/internal/mocks"
|
|
|
|
"github.com/authelia/authelia/internal/configuration/schema"
|
|
"github.com/stretchr/testify/suite"
|
|
)
|
|
|
|
type SecondFactorAvailableMethodsFixture struct {
|
|
suite.Suite
|
|
mock *mocks.MockAutheliaCtx
|
|
}
|
|
|
|
func (s *SecondFactorAvailableMethodsFixture) SetupTest() {
|
|
s.mock = mocks.NewMockAutheliaCtx(s.T())
|
|
}
|
|
|
|
func (s *SecondFactorAvailableMethodsFixture) TearDownTest() {
|
|
s.mock.Close()
|
|
}
|
|
|
|
func (s *SecondFactorAvailableMethodsFixture) TestShouldServeDefaultMethods() {
|
|
expectedBody := ExtendedConfigurationBody{
|
|
AvailableMethods: []string{"totp", "u2f"},
|
|
}
|
|
ExtendedConfigurationGet(s.mock.Ctx)
|
|
s.mock.Assert200OK(s.T(), expectedBody)
|
|
}
|
|
|
|
func (s *SecondFactorAvailableMethodsFixture) TestShouldServeDefaultMethodsAndMobilePush() {
|
|
s.mock.Ctx.Configuration = schema.Configuration{
|
|
DuoAPI: &schema.DuoAPIConfiguration{},
|
|
}
|
|
expectedBody := ExtendedConfigurationBody{
|
|
AvailableMethods: []string{"totp", "u2f", "mobile_push"},
|
|
}
|
|
ExtendedConfigurationGet(s.mock.Ctx)
|
|
s.mock.Assert200OK(s.T(), expectedBody)
|
|
}
|
|
|
|
func TestRunSuite(t *testing.T) {
|
|
s := new(SecondFactorAvailableMethodsFixture)
|
|
suite.Run(t, s)
|
|
}
|