Skip to content

Commit

Permalink
Update broker tests with the validator changes
Browse files Browse the repository at this point in the history
  • Loading branch information
denisonbarbosa committed Aug 17, 2023
1 parent 063d76f commit 8858033
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions internal/brokers/broker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,29 @@ import (
"github.com/ubuntu/authd/internal/testutils"
)

var supportedLayouts = []map[string]string{
// form layout
{
"type": "form",
"label": "required",
"entry": "optional:chars,chars_password",
"wait": "optional:true,false",
},
// qrcode layout
{
"type": "qrcode",
"label": "optional",
"content": "required",
"wait": "required:true,false",
},
// newpassword layout
{
"type": "newpassword",
"label": "required",
"entry": "required:chars,chars_password",
},
}

func TestNewBroker(t *testing.T) {
t.Parallel()

Expand Down Expand Up @@ -142,6 +165,7 @@ func TestSelectAuthenticationMode(t *testing.T) {
t.Parallel()

b, _ := newBrokerForTests(t)
b.GenerateLayoutValidators(supportedLayouts)

gotUI, err := b.SelectAuthenticationMode(context.Background(), tc.sessionID, "mode1")
if tc.wantErr {
Expand Down

0 comments on commit 8858033

Please sign in to comment.