test(middleware): add GetAuthStatus to stubAuthService and fix error message capitalization
- commit
- e32c0a44c1c036466260d80160e4206baaf21c94
- author
- bnema · · 2026-01-28 21:36 UTC
- parent
- a66330d
- signature
- unsigned
2 files · +6 -2
M internal/adapters/in/cli/auth.go +2 -2
| @@ -683,12 +683,12 @@ func runAuthStatus() error { | |||
| 683 | 683 | // Determine active remote | |
| 684 | 684 | remoteName := config.Active | |
| 685 | 685 | if remoteName == "" { | |
| 686 | - | return fmt.Errorf("No active remote configured. Use 'gordon remote use <name>' or --remote flag") | |
| 686 | + | return fmt.Errorf("no active remote configured. Use 'gordon remote use <name>' or --remote flag") | |
| 687 | 687 | } | |
| 688 | 688 | ||
| 689 | 689 | remoteConfig, ok := config.Remotes[remoteName] | |
| 690 | 690 | if !ok { | |
| 691 | - | return fmt.Errorf("Active remote '%s' not found", remoteName) | |
| 691 | + | return fmt.Errorf("active remote '%s' not found", remoteName) | |
| 692 | 692 | } | |
| 693 | 693 | ||
| 694 | 694 | // Create client | |
| @@ -683,12 +683,12 @@ func runAuthStatus() error { | |||||
| 683 | // Determine active remote | 683 | // Determine active remote | ||
| 684 | remoteName := config.Active | 684 | remoteName := config.Active | ||
| 685 | if remoteName == "" { | 685 | if remoteName == "" { | ||
| 686 | - | return fmt.Errorf("No active remote configured. Use 'gordon remote use <name>' or --remote flag") | 686 | + | return fmt.Errorf("no active remote configured. Use 'gordon remote use <name>' or --remote flag") |
| 687 | } | 687 | } | ||
| 688 | 688 | ||||
| 689 | remoteConfig, ok := config.Remotes[remoteName] | 689 | remoteConfig, ok := config.Remotes[remoteName] | ||
| 690 | if !ok { | 690 | if !ok { | ||
| 691 | - | return fmt.Errorf("Active remote '%s' not found", remoteName) | 691 | + | return fmt.Errorf("active remote '%s' not found", remoteName) |
| 692 | } | 692 | } | ||
| 693 | 693 | ||||
| 694 | // Create client | 694 | // Create client | ||
M internal/adapters/in/http/middleware/auth_test.go +4 -0
| @@ -501,6 +501,10 @@ func (s stubAuthService) GeneratePasswordHash(string) (string, error) { | |||
| 501 | 501 | return "", errors.New("not implemented") | |
| 502 | 502 | } | |
| 503 | 503 | ||
| 504 | + | func (s stubAuthService) GetAuthStatus(context.Context) (*domain.AuthStatus, error) { | |
| 505 | + | return nil, errors.New("not implemented") | |
| 506 | + | } | |
| 507 | + | ||
| 504 | 508 | // Tests for checkScopeAccess function | |
| 505 | 509 | ||
| 506 | 510 | func TestCheckScopeAccess_ActionMapping(t *testing.T) { | |
| @@ -501,6 +501,10 @@ func (s stubAuthService) GeneratePasswordHash(string) (string, error) { | |||||
| 501 | return "", errors.New("not implemented") | 501 | return "", errors.New("not implemented") | ||
| 502 | } | 502 | } | ||
| 503 | 503 | ||||
| 504 | + | func (s stubAuthService) GetAuthStatus(context.Context) (*domain.AuthStatus, error) { | |||
| 505 | + | return nil, errors.New("not implemented") | |||
| 506 | + | } | |||
| 507 | + | ||||
| 504 | // Tests for checkScopeAccess function | 508 | // Tests for checkScopeAccess function | ||
| 505 | 509 | ||||
| 506 | func TestCheckScopeAccess_ActionMapping(t *testing.T) { | 510 | func TestCheckScopeAccess_ActionMapping(t *testing.T) { | ||