mirror of
https://github.com/roleypoly/roleypoly.git
synced 2025-04-24 19:39:11 +00:00
24 lines
670 B
Go
24 lines
670 B
Go
package loginbounce_test
|
|
|
|
import (
|
|
"net/http/httptest"
|
|
"testing"
|
|
|
|
"github.com/onsi/gomega"
|
|
loginbounce "github.com/roleypoly/roleypoly/src/functions/login-bounce"
|
|
)
|
|
|
|
func TestBounce(t *testing.T) {
|
|
O := gomega.NewWithT(t)
|
|
|
|
req := httptest.NewRequest("GET", "/login-bounce?redirect_url=https://localhost:6600/test", nil)
|
|
rw := httptest.NewRecorder()
|
|
|
|
loginbounce.LoginBounce(rw, req)
|
|
|
|
resp := rw.Result()
|
|
|
|
O.Expect(resp.StatusCode).Should(gomega.BeIdenticalTo(303))
|
|
O.Expect(resp.Header.Get("location")).Should(gomega.ContainSubstring("identify,guild"))
|
|
O.Expect(resp.Header.Get("set-cookie")).Should(gomega.ContainSubstring("https://localhost:6600/test"))
|
|
}
|