diff --git a/internal/suites/suite_bypass_all_test.go b/internal/suites/suite_bypass_all_test.go index 3e21c719..f47d4673 100644 --- a/internal/suites/suite_bypass_all_test.go +++ b/internal/suites/suite_bypass_all_test.go @@ -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()) } diff --git a/internal/suites/suite_docker_test.go b/internal/suites/suite_docker_test.go index 67d5e7ea..95462645 100644 --- a/internal/suites/suite_docker_test.go +++ b/internal/suites/suite_docker_test.go @@ -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()) } diff --git a/internal/suites/suite_duo_push_test.go b/internal/suites/suite_duo_push_test.go index 405f8ce7..ff61079b 100644 --- a/internal/suites/suite_duo_push_test.go +++ b/internal/suites/suite_duo_push_test.go @@ -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()) } diff --git a/internal/suites/suite_high_availability_test.go b/internal/suites/suite_high_availability_test.go index 562676d1..f19084bb 100644 --- a/internal/suites/suite_high_availability_test.go +++ b/internal/suites/suite_high_availability_test.go @@ -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()) } diff --git a/internal/suites/suite_kubernetes_test.go b/internal/suites/suite_kubernetes_test.go index f41679c5..8162e882 100644 --- a/internal/suites/suite_kubernetes_test.go +++ b/internal/suites/suite_kubernetes_test.go @@ -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()) } diff --git a/internal/suites/suite_ldap_test.go b/internal/suites/suite_ldap_test.go index 521dcf4e..0794fbad 100644 --- a/internal/suites/suite_ldap_test.go +++ b/internal/suites/suite_ldap_test.go @@ -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()) } diff --git a/internal/suites/suite_mariadb_test.go b/internal/suites/suite_mariadb_test.go index c114bb00..1b29de7c 100644 --- a/internal/suites/suite_mariadb_test.go +++ b/internal/suites/suite_mariadb_test.go @@ -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()) } diff --git a/internal/suites/suite_postgres_test.go b/internal/suites/suite_postgres_test.go index 59af70cd..805f20c6 100644 --- a/internal/suites/suite_postgres_test.go +++ b/internal/suites/suite_postgres_test.go @@ -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()) } diff --git a/internal/suites/suite_short_timeouts_test.go b/internal/suites/suite_short_timeouts_test.go index 58f51f4e..675638f6 100644 --- a/internal/suites/suite_short_timeouts_test.go +++ b/internal/suites/suite_short_timeouts_test.go @@ -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()) } diff --git a/internal/suites/suite_standalone_test.go b/internal/suites/suite_standalone_test.go index 6629d538..8265844a 100644 --- a/internal/suites/suite_standalone_test.go +++ b/internal/suites/suite_standalone_test.go @@ -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()) } diff --git a/internal/suites/suite_traefik_test.go b/internal/suites/suite_traefik_test.go index 0d87ab77..cc7505ee 100644 --- a/internal/suites/suite_traefik_test.go +++ b/internal/suites/suite_traefik_test.go @@ -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()) }