mirror of
https://github.com/0rangebananaspy/authelia.git
synced 2024-09-14 22:47:21 +07:00
Be able to run scenarii in isolation for each suite.
This commit is contained in:
parent
2b544346f3
commit
336276be98
|
@ -10,15 +10,15 @@ import (
|
|||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type BypassAllSuite struct {
|
||||
type BypassAllWebDriverSuite struct {
|
||||
*SeleniumSuite
|
||||
}
|
||||
|
||||
func NewBypassAllSuite() *BypassAllSuite {
|
||||
return &BypassAllSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
func NewBypassAllWebDriverSuite() *BypassAllWebDriverSuite {
|
||||
return &BypassAllWebDriverSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func (s *BypassAllSuite) SetupSuite() {
|
||||
func (s *BypassAllWebDriverSuite) SetupSuite() {
|
||||
wds, err := StartWebDriver()
|
||||
|
||||
if err != nil {
|
||||
|
@ -28,7 +28,7 @@ func (s *BypassAllSuite) SetupSuite() {
|
|||
s.WebDriverSession = wds
|
||||
}
|
||||
|
||||
func (s *BypassAllSuite) TearDownSuite() {
|
||||
func (s *BypassAllWebDriverSuite) TearDownSuite() {
|
||||
err := s.WebDriverSession.Stop()
|
||||
|
||||
if err != nil {
|
||||
|
@ -36,7 +36,7 @@ func (s *BypassAllSuite) TearDownSuite() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *BypassAllSuite) TestShouldAccessPublicResource() {
|
||||
func (s *BypassAllWebDriverSuite) TestShouldAccessPublicResource() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
|
||||
defer cancel()
|
||||
|
||||
|
@ -47,7 +47,22 @@ func (s *BypassAllSuite) TestShouldAccessPublicResource() {
|
|||
s.verifySecretAuthorized(ctx, s.T())
|
||||
}
|
||||
|
||||
type BypassAllSuite struct {
|
||||
suite.Suite
|
||||
}
|
||||
|
||||
func NewBypassAllSuite() *BypassAllSuite {
|
||||
return &BypassAllSuite{}
|
||||
}
|
||||
|
||||
func (s *BypassAllSuite) TestBypassAllWebDriverSuite() {
|
||||
suite.Run(s.T(), NewBypassAllWebDriverSuite())
|
||||
}
|
||||
|
||||
func (s *BypassAllSuite) TestCustomHeadersScenario() {
|
||||
suite.Run(s.T(), NewCustomHeadersScenario())
|
||||
}
|
||||
|
||||
func TestBypassAllSuite(t *testing.T) {
|
||||
suite.Run(t, NewBypassAllSuite())
|
||||
suite.Run(t, NewCustomHeadersScenario())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewDockerSuite() *DockerSuite {
|
|||
return &DockerSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestDockerSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *DockerSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *DockerSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestDockerSuite(t *testing.T) {
|
||||
suite.Run(t, NewDockerSuite())
|
||||
}
|
||||
|
|
|
@ -9,15 +9,15 @@ import (
|
|||
"github.com/stretchr/testify/suite"
|
||||
)
|
||||
|
||||
type DuoPushSuite struct {
|
||||
type DuoPushWebDriverSuite struct {
|
||||
*SeleniumSuite
|
||||
}
|
||||
|
||||
func NewDuoPushSuite() *DuoPushSuite {
|
||||
return &DuoPushSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
func NewDuoPushWebDriverSuite() *DuoPushWebDriverSuite {
|
||||
return &DuoPushWebDriverSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) SetupSuite() {
|
||||
func (s *DuoPushWebDriverSuite) SetupSuite() {
|
||||
wds, err := StartWebDriver()
|
||||
|
||||
if err != nil {
|
||||
|
@ -27,7 +27,7 @@ func (s *DuoPushSuite) SetupSuite() {
|
|||
s.WebDriverSession = wds
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TearDownSuite() {
|
||||
func (s *DuoPushWebDriverSuite) TearDownSuite() {
|
||||
err := s.WebDriverSession.Stop()
|
||||
|
||||
if err != nil {
|
||||
|
@ -35,14 +35,14 @@ func (s *DuoPushSuite) TearDownSuite() {
|
|||
}
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) SetupTest() {
|
||||
func (s *DuoPushWebDriverSuite) SetupTest() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
s.doLogout(ctx, s.T())
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TearDownTest() {
|
||||
func (s *DuoPushWebDriverSuite) TearDownTest() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
|
||||
defer cancel()
|
||||
|
||||
|
@ -50,7 +50,7 @@ func (s *DuoPushSuite) TearDownTest() {
|
|||
s.WaitElementLocatedByID(ctx, s.T(), "one-time-password-method")
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TestShouldSucceedAuthentication() {
|
||||
func (s *DuoPushWebDriverSuite) TestShouldSucceedAuthentication() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
|
@ -61,7 +61,7 @@ func (s *DuoPushSuite) TestShouldSucceedAuthentication() {
|
|||
s.WaitElementLocatedByClassName(ctx, s.T(), "success-icon")
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TestShouldFailAuthentication() {
|
||||
func (s *DuoPushWebDriverSuite) TestShouldFailAuthentication() {
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 15*time.Second)
|
||||
defer cancel()
|
||||
|
||||
|
@ -72,11 +72,29 @@ func (s *DuoPushSuite) TestShouldFailAuthentication() {
|
|||
s.WaitElementLocatedByClassName(ctx, s.T(), "failure-icon")
|
||||
}
|
||||
|
||||
func TestDuoPushSuite(t *testing.T) {
|
||||
suite.Run(t, NewDuoPushSuite())
|
||||
suite.Run(t, NewAvailableMethodsScenario([]string{
|
||||
type DuoPushSuite struct {
|
||||
suite.Suite
|
||||
}
|
||||
|
||||
func NewDuoPushSuite() *DuoPushSuite {
|
||||
return &DuoPushSuite{}
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TestDuoPushWebDriverSuite() {
|
||||
suite.Run(s.T(), NewDuoPushWebDriverSuite())
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TestAvailableMethodsScenario() {
|
||||
suite.Run(s.T(), NewAvailableMethodsScenario([]string{
|
||||
"ONE-TIME PASSWORD",
|
||||
"PUSH NOTIFICATION",
|
||||
}))
|
||||
suite.Run(t, NewUserPreferencesScenario())
|
||||
}
|
||||
|
||||
func (s *DuoPushSuite) TestUserPreferencesScenario() {
|
||||
suite.Run(s.T(), NewUserPreferencesScenario())
|
||||
}
|
||||
|
||||
func TestDuoPushSuite(t *testing.T) {
|
||||
suite.Run(t, NewDuoPushSuite())
|
||||
}
|
||||
|
|
|
@ -203,15 +203,32 @@ func (s *HighAvailabilitySuite) TestBasicAuth() {
|
|||
s.Assert().Equal(DoGetWithAuth(s.T(), "john", "password"), 200)
|
||||
s.Assert().Equal(DoGetWithAuth(s.T(), "john", "bad-password"), 302)
|
||||
s.Assert().Equal(DoGetWithAuth(s.T(), "dontexist", "password"), 302)
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestRegulationScenario() {
|
||||
suite.Run(s.T(), NewRegulationScenario())
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestCustomHeadersScenario() {
|
||||
suite.Run(s.T(), NewCustomHeadersScenario())
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestRedirectionCheckScenario() {
|
||||
suite.Run(s.T(), NewRedirectionCheckScenario())
|
||||
}
|
||||
|
||||
func (s *HighAvailabilitySuite) TestHighAvailabilityWebDriverSuite() {
|
||||
suite.Run(s.T(), NewHighAvailabilityWebDriverSuite())
|
||||
}
|
||||
|
||||
func TestHighAvailabilitySuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
suite.Run(t, NewRegulationScenario())
|
||||
suite.Run(t, NewCustomHeadersScenario())
|
||||
suite.Run(t, NewRedirectionCheckScenario())
|
||||
suite.Run(t, NewHighAvailabilityWebDriverSuite())
|
||||
suite.Run(t, NewHighAvailabilitySuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewKubernetesSuite() *KubernetesSuite {
|
|||
return &KubernetesSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestKubernetesSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *KubernetesSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *KubernetesSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestKubernetesSuite(t *testing.T) {
|
||||
suite.Run(t, NewKubernetesSuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewLDAPSuite() *LDAPSuite {
|
|||
return &LDAPSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestLDAPSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *LDAPSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *LDAPSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestLDAPSuite(t *testing.T) {
|
||||
suite.Run(t, NewLDAPSuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewMariadbSuite() *MariadbSuite {
|
|||
return &MariadbSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestMariadbSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *MariadbSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *MariadbSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestMariadbSuite(t *testing.T) {
|
||||
suite.Run(t, NewMariadbSuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewPostgresSuite() *PostgresSuite {
|
|||
return &PostgresSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestPostgresSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *PostgresSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *PostgresSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestPostgresSuite(t *testing.T) {
|
||||
suite.Run(t, NewPostgresSuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewShortTimeoutsSuite() *ShortTimeoutsSuite {
|
|||
return &ShortTimeoutsSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestShortTimeoutsSuite(t *testing.T) {
|
||||
suite.Run(t, NewInactivityScenario())
|
||||
suite.Run(t, NewRegulationScenario())
|
||||
func (s *ShortTimeoutsSuite) TestInactivityScenario() {
|
||||
suite.Run(s.T(), NewInactivityScenario())
|
||||
}
|
||||
|
||||
func (s *ShortTimeoutsSuite) TestRegulationScenario() {
|
||||
suite.Run(s.T(), NewRegulationScenario())
|
||||
}
|
||||
|
||||
func TestShortTimeoutsSuite(t *testing.T) {
|
||||
suite.Run(t, NewShortTimeoutsSuite())
|
||||
}
|
||||
|
|
|
@ -121,18 +121,34 @@ func (s *StandaloneSuite) TestShouldVerifyAPIVerifyRedirectFromXOriginalHostURI(
|
|||
s.Assert().Equal(string(body), fmt.Sprintf("Found. Redirecting to %s?rd=https://secure.example.com:8080/", LoginBaseURL))
|
||||
}
|
||||
|
||||
func TestStandaloneWebDriverScenario(t *testing.T) {
|
||||
suite.Run(t, NewStandaloneWebDriverSuite())
|
||||
func (s *StandaloneSuite) TestStandaloneWebDriverScenario() {
|
||||
suite.Run(s.T(), NewStandaloneWebDriverSuite())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestBypassPolicyScenario() {
|
||||
suite.Run(s.T(), NewBypassPolicyScenario())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestBackendProtectionScenario() {
|
||||
suite.Run(s.T(), NewBackendProtectionScenario())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestResetPasswordScenario() {
|
||||
suite.Run(s.T(), NewResetPasswordScenario())
|
||||
}
|
||||
|
||||
func (s *StandaloneSuite) TestAvailableMethodsScenario() {
|
||||
suite.Run(s.T(), NewAvailableMethodsScenario([]string{"ONE-TIME PASSWORD"}))
|
||||
}
|
||||
|
||||
func TestStandaloneSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
suite.Run(t, NewBypassPolicyScenario())
|
||||
suite.Run(t, NewBackendProtectionScenario())
|
||||
suite.Run(t, NewResetPasswordScenario())
|
||||
suite.Run(t, NewAvailableMethodsScenario([]string{"ONE-TIME PASSWORD"}))
|
||||
|
||||
suite.Run(t, NewStandaloneWebDriverSuite())
|
||||
suite.Run(t, NewStandaloneSuite())
|
||||
}
|
||||
|
|
|
@ -14,7 +14,14 @@ func NewTraefikSuite() *TraefikSuite {
|
|||
return &TraefikSuite{SeleniumSuite: new(SeleniumSuite)}
|
||||
}
|
||||
|
||||
func TestTraefikSuite(t *testing.T) {
|
||||
suite.Run(t, NewOneFactorScenario())
|
||||
suite.Run(t, NewTwoFactorScenario())
|
||||
func (s *TraefikSuite) TestOneFactorScenario() {
|
||||
suite.Run(s.T(), NewOneFactorScenario())
|
||||
}
|
||||
|
||||
func (s *TraefikSuite) TestTwoFactorScenario() {
|
||||
suite.Run(s.T(), NewTwoFactorScenario())
|
||||
}
|
||||
|
||||
func TestTraefikSuite(t *testing.T) {
|
||||
suite.Run(t, NewTraefikSuite())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user