Commit a06598e
Changed files (2)
bin
test
bin/e2e
@@ -1,23 +0,0 @@
-#!/bin/sh
-
-set -e
-BROWSER="w3m"
-
-if [ -n "${DEBUG}" ]; then
- set -x
- BROWSER="xdg-open"
-fi
-
-curl http://idp.example.com:8080/saml/metadata.xml
-curl http://idp.example.com:8080/.well-known/openid-configuration
-curl http://idp.example.com:8080/.well-known/oauth-authorization-server
-curl http://idp.example.com:8080/.well-known/webfinger
-
-curl http://ui.example.com:8080/saml/metadata.xml
-
-$BROWSER http://ui.example.com:8080/saml/new
-$BROWSER http://ui.example.com:8080/oidc/new
-
-curl http://api.example.com:8080/projects.json
-curl -H 'Authorization: Bearer eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2YmYxZTlmMy02OGIwLTQ4NmYtOGVlZi0wODFmZTg2YjJlODMiLCJpYXQiOjE3NDEyOTAzMzJ9.e30=' -XPOST http://api.example.com:8080/projects --data '{"name": "gitlab"}'
-curl http://api.example.com:8080/projects.json
test/e2e_test.go
@@ -35,35 +35,31 @@ func TestAuthx(t *testing.T) {
}()
t.Run("SAML", func(t *testing.T) {
- t.Run("IdP", func(t *testing.T) {
- t.Run("metadata.xml", func(t *testing.T) {
- response := x.Must(http.Get("http://idp.example.com:8080/saml/metadata.xml"))
- assert.Equal(t, http.StatusOK, response.StatusCode)
- })
+ t.Run("GET http://idp.example.com:8080/saml/metadata.xml", func(t *testing.T) {
+ response := x.Must(http.Get("http://idp.example.com:8080/saml/metadata.xml"))
+ assert.Equal(t, http.StatusOK, response.StatusCode)
})
- t.Run("SP", func(t *testing.T) {
- t.Run("metadata.xml", func(t *testing.T) {
- response := x.Must(http.Get("http://ui.example.com:8080/saml/metadata.xml"))
- assert.Equal(t, http.StatusOK, response.StatusCode)
- })
+ t.Run("GET http://ui.example.com:8080/saml/metadata.xml", func(t *testing.T) {
+ response := x.Must(http.Get("http://ui.example.com:8080/saml/metadata.xml"))
+ assert.Equal(t, http.StatusOK, response.StatusCode)
+ })
- t.Run("ACS", func(t *testing.T) {
- x.Must(page.Goto("http://ui.example.com:8080/saml/new"))
- action := x.Must(page.Locator("#idp-form").GetAttribute("action"))
- assert.Equal(t, "http://idp.example.com:8080/saml/new", action)
- assert.NoError(t, page.Locator("#submit-button").Click())
+ t.Run("GET http://ui.example.com:8080/saml/new", func(t *testing.T) {
+ x.Must(page.Goto("http://ui.example.com:8080/saml/new"))
+ action := x.Must(page.Locator("#idp-form").GetAttribute("action"))
+ assert.Equal(t, "http://idp.example.com:8080/saml/new", action)
+ assert.NoError(t, page.Locator("#submit-button").Click())
- action = x.Must(page.Locator("#postback-form").GetAttribute("action"))
- assert.Equal(t, "http://ui.example.com:8080/saml/assertions", action)
- assert.NoError(t, page.Locator("#submit-button").Click())
- assert.Contains(t, x.Must(page.Content()), "Received SAML Response")
- })
+ action = x.Must(page.Locator("#postback-form").GetAttribute("action"))
+ assert.Equal(t, "http://ui.example.com:8080/saml/assertions", action)
+ assert.NoError(t, page.Locator("#submit-button").Click())
+ assert.Contains(t, x.Must(page.Content()), "Received SAML Response")
})
})
t.Run("OIDC", func(t *testing.T) {
- t.Run("login", func(t *testing.T) {
+ t.Run("GET http://ui.example.com:8080/oidc/new", func(t *testing.T) {
x.Must(page.Goto("http://ui.example.com:8080/oidc/new"))
assert.Contains(t, page.URL(), "http://idp.example.com:8080/oauth/authorize")
assert.NoError(t, page.Locator("#submit-button").Click())