MCPcopy Create free account
hub / github.com/devaccuracy/ledgerforge / TestAPIKey_HasScope

Function TestAPIKey_HasScope

model/model_test.go:652–673  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

650}
651
652func TestAPIKey_HasScope(t *testing.T) {
653 apiKey := &APIKey{
654 Scopes: []string{"read", "write", "admin"},
655 }
656
657 t.Run("Has scope - read", func(t *testing.T) {
658 assert.True(t, apiKey.HasScope("read"))
659 })
660
661 t.Run("Has scope - admin", func(t *testing.T) {
662 assert.True(t, apiKey.HasScope("admin"))
663 })
664
665 t.Run("Does not have scope", func(t *testing.T) {
666 assert.False(t, apiKey.HasScope("delete"))
667 })
668
669 t.Run("Empty scopes", func(t *testing.T) {
670 emptyKey := &APIKey{Scopes: []string{}}
671 assert.False(t, emptyKey.HasScope("read"))
672 })
673}
674
675func TestConvertToStructFieldName(t *testing.T) {
676 tests := []struct {

Callers

nothing calls this directly

Calls 1

HasScopeMethod · 0.95

Tested by

no test coverage detected