-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: improve the builder pattern and increase coverage
- Loading branch information
1 parent
30bb76b
commit ee732c8
Showing
5 changed files
with
177 additions
and
75 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
package authenticator_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/snapp-incubator/soteria/internal/authenticator" | ||
"github.com/snapp-incubator/soteria/internal/config" | ||
"github.com/stretchr/testify/require" | ||
"go.uber.org/zap" | ||
) | ||
|
||
func TestBuilderInternalAuthenticator(t *testing.T) { | ||
t.Parallel() | ||
|
||
require := require.New(t) | ||
|
||
b := authenticator.Builder{ | ||
Vendors: []config.Vendor{ | ||
{ | ||
Company: "internal", | ||
Jwt: config.Jwt{ | ||
IssName: "iss", | ||
SubName: "sub", | ||
SigningMethod: "HS512", | ||
}, | ||
IsInternal: true, | ||
UseValidator: false, | ||
AllowedAccessTypes: nil, | ||
Topics: nil, | ||
HashIDMap: nil, | ||
IssEntityMap: nil, | ||
IssPeerMap: nil, | ||
Keys: map[string]string{ | ||
"system": "c2VjcmV0", | ||
}, | ||
}, | ||
}, | ||
Logger: zap.NewNop(), | ||
ValidatorConfig: config.Validator{ | ||
URL: "", | ||
Timeout: 0, | ||
}, | ||
} | ||
|
||
vendors, err := b.Authenticators() | ||
require.NoError(err) | ||
require.Len(vendors, 1) | ||
require.Contains(vendors, "internal") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters