ultisuite-backend/internal/apitokens/scope_test.go
R3D347HR4Y bd7534658a Refactor and enhance unified frontend and API features
- Updated environment configuration to unify frontend for mail and drive under a single service.
- Revised README to reflect changes in frontend setup and routing for the unified application.
- Introduced new API documentation endpoints for better accessibility of API specifications.
- Enhanced drive and mail services with improved handling of file uploads and metadata enrichment.
- Implemented new API token management features, including creation, listing, and revocation of tokens.
- Added tests for new functionalities in drive and mail services to ensure reliability and correctness.
2026-06-07 15:44:30 +02:00

34 lines
734 B
Go

package apitokens
import "testing"
func TestDrivePathWithinScope(t *testing.T) {
auth := &AuthContext{
DriveScope: DriveScope{
AllFolders: false,
FolderPaths: []string{"/Projects"},
},
}
if !AllowsDrivePath(auth, "/Projects/docs/report.pdf") {
t.Fatal("expected nested path within /Projects")
}
if AllowsDrivePath(auth, "/Personal/notes.txt") {
t.Fatal("did not expect /Personal to be allowed")
}
}
func TestAllowsMailAccountScoped(t *testing.T) {
auth := &AuthContext{
MailScope: MailScope{
AllAccounts: false,
AccountIDs: []string{"acc-1"},
},
}
if !AllowsMailAccount(auth, "acc-1") {
t.Fatal("expected acc-1")
}
if AllowsMailAccount(auth, "acc-2") {
t.Fatal("did not expect acc-2")
}
}