Skip to content

Commit a230100

Browse files
committed
Format functests a bit better
1 parent 9d5f1cf commit a230100

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

filter/converter_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -579,34 +579,49 @@ func TestConverter_AccessControl(t *testing.T) {
579579

580580
t.Run("allow all, single root field",
581581
f(`{"name":"John"}`, nil, filter.WithAllowAllColumns()))
582+
582583
t.Run("allow name, single allowed root field",
583584
f(`{"name":"John"}`, nil, filter.WithAllowColumns("name")))
585+
584586
t.Run("allow name, single disallowed root field",
585587
f(`{"password":"hacks"}`, no("password"), filter.WithAllowColumns("name")))
588+
586589
t.Run("allowed meta, single allowed nested field",
587590
f(`{"map":"de_dust"}`, nil, filter.WithNestedJSONB("meta", "created_at")))
591+
588592
t.Run("allowed nested excemption, single allowed field",
589593
f(`{"created_at":"de_dust"}`, nil, filter.WithNestedJSONB("meta", "created_at")))
594+
590595
t.Run("multi allow, single allowed root field",
591596
f(`{"name":"John"}`, nil, filter.WithAllowColumns("name", "email")))
597+
592598
t.Run("multi allow, two allowed root fields",
593599
f(`{"name":"John", "email":"[email protected]"}`, nil, filter.WithAllowColumns("name", "email")))
600+
594601
t.Run("multi allow, mixes access",
595602
f(`{"name":"John", "password":"hacks"}`, no("password"), filter.WithAllowColumns("name", "email")))
603+
596604
t.Run("multi allow, mixes access",
597605
f(`{"name":"John", "password":"hacks"}`, no("password"), filter.WithAllowColumns("name", "email")))
606+
598607
t.Run("allowed basic $and",
599608
f(`{"$and": [{"name": "John"}, {"version": 3}]}`, nil, filter.WithAllowColumns("name", "version")))
609+
600610
t.Run("disallowed basic $and",
601611
f(`{"$and": [{"name": "John"}, {"version": 3}]}`, no("version"), filter.WithAllowColumns("name")))
612+
602613
t.Run("allow all but one",
603614
f(`{"name": "John"}`, nil, filter.WithAllowAllColumns(), filter.WithDisallowColumns("password")))
615+
604616
t.Run("allow all but one, failing",
605617
f(`{"$and": [{"name": "John"}, {"password": "hacks"}]}`, no("password"), filter.WithAllowAllColumns(), filter.WithDisallowColumns("password")))
618+
606619
t.Run("nested but disallow password, allow exception",
607620
f(`{"created_at": "1"}`, nil, filter.WithNestedJSONB("meta", "created_at"), filter.WithDisallowColumns("password")))
621+
608622
t.Run("nested but disallow password, allow nested",
609623
f(`{"map": "de_dust"}`, nil, filter.WithNestedJSONB("meta", "created_at"), filter.WithDisallowColumns("password")))
624+
610625
t.Run("nested but disallow password, disallow",
611626
f(`{"password": "hacks"}`, no("password"), filter.WithNestedJSONB("meta", "created_at"), filter.WithDisallowColumns("password")))
612627
}

0 commit comments

Comments
 (0)