Keys' project paths written as the API takes them, Acme/ml/search

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Ilker ManapandClaude Opus 5.5 committed 2026-10-09 06:46:12 +02:00
1 parent 15a209e652
commit 5be3da505b
2 files changed
+4 -1

No files matched your search

+3
View File
@@ -410,6 +410,9 @@ func keyState(k store.Key, now time.Time) string {
}
func keyView(k store.Key, path, email string, now time.Time) KeyView {
// The store says "Acme / ml / search"; a path given to the API is
// written Acme/ml/search, and is answered the same way.
path = strings.ReplaceAll(path, " / ", "/")
return KeyView{ID: k.ID, Name: k.Name, Prefix: k.Prefix, Project: k.ProjectID, ProjectPath: path,
User: k.UserID, UserEmail: email, Band: k.Band, RoutingProfile: k.RoutingProfile, State: keyState(k, now),
CreatedAt: k.CreatedAt, ExpiresAt: k.ExpiresAt, RevokedAt: k.RevokedAt, LastUsedAt: k.LastUsedAt}
+1 -1
View File
@@ -93,7 +93,7 @@ func TestTheTenancyTreeKeysAndMembershipsAreAdministered(t *testing.T) {
}
var keys []KeyView
do("GET", "/api/v1/keys?project="+crm, "", &keys)
if len(keys) != 1 || keys[0].ID != key.ID || keys[0].State != "active" {
if len(keys) != 1 || keys[0].ID != key.ID || keys[0].State != "active" || keys[0].ProjectPath != "Other/hr/crm2" {
t.Errorf("the project's keys: %+v", keys)
}
raw := httptest.NewRecorder()