-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug_test.go
40 lines (31 loc) · 1.09 KB
/
debug_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
package brute
import (
"testing"
"github.com/stretchr/testify/assert"
"strings"
)
func TestValidSourceValue(t *testing.T) {
sample := `Div().Value(func() {
Form().Action("/login").Post().Value(func() {
Span().Value("Username: "); TextField("username"); Break()
Span().Value("Password: "); PasswordField("password"); Break()
Input().Class("hello").Attributes(NewAttr("type", "hidden"), NewAttr("name", "csrf"), NewAttr("value", "h123h123o3")).Value(nil)
}, Submit("Login"))
})`
source := Compile([]byte(sample))
var actual []string
for _, s := range source {
actual = append(actual, string(s))
}
assert.Equal(t, sample, strings.Join(actual, "\n"))
}
func TestBlamePartSource(t *testing.T) {
sample := `Div().Value(func() {
Form().Action("/login").Post().Value(func() { d
Span().Value("Username: "); TextField("username"); Break()
Span().Value("Password: "); PasswordField("password"); Break()
Input().Class("hello").Attributes(NewAttr("type", "hidden"), NewAttr("name", "csrf"), NewAttr("value", "h123h123o3")).Value(nil)
}, Submit("Login"))
})`
assert.Equal(t, )
}