Fix broken test

This commit is contained in:
Melon 2023-12-13 02:08:29 +00:00
parent b4787f22aa
commit 5a9e8e7e2e
Signed by: melon
GPG Key ID: 6C9D970C50D26A25

View File

@ -356,9 +356,9 @@ func TestFlowCallback(t *testing.T) {
<script> <script>
let loginData = { let loginData = {
target:"%s", target:"%s",
userinfo:{"aud":"%s","sub":"test-user","test-field":"ok"},
tokens: ` tokens: `
const p2 = `, const p2 = `,
userinfo:{"aud":"%s","sub":"test-user","test-field":"ok"},
}; };
window.addEventListener("load", function () { window.addEventListener("load", function () {
window.opener.postMessage(loginData, loginData.target); window.opener.postMessage(loginData, loginData.target);
@ -376,7 +376,8 @@ func TestFlowCallback(t *testing.T) {
</body> </body>
</html> </html>
` `
var p1v = fmt.Sprintf(p1, clientAppDomain, clientAppDomain) var p1v = fmt.Sprintf(p1, clientAppDomain)
var p2v = fmt.Sprintf(p2, clientAppDomain)
a := make([]byte, len(p1v)) a := make([]byte, len(p1v))
n, err := rec.Body.Read(a) n, err := rec.Body.Read(a)
@ -394,7 +395,7 @@ func TestFlowCallback(t *testing.T) {
findByte(rec.Body, ',') findByte(rec.Body, ',')
findByte(rec.Body, '}') findByte(rec.Body, '}')
assert.Equal(t, p2, rec.Body.String()) assert.Equal(t, p2v, rec.Body.String())
} }
func findByte(buf *bytes.Buffer, v byte) { func findByte(buf *bytes.Buffer, v byte) {