The slug "breakpilot" was reserved (#32) so no customer could pose as Breakpilot. Sharang decided (12.11.) that the company's own workspace is app.breakpilot.com/breakpilot. Staff (a named staff member on the admin client) may now create exactly this slug; everyone else, and the trial offer's slug choice, still get reserved_slug. The other reserved slugs stay closed to staff too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
25 lines
1.1 KiB
Go
25 lines
1.1 KiB
Go
package server
|
|
|
|
import (
|
|
"net/http"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func TestCreateTenant_brandSlugOnlyForStaff(t *testing.T) {
|
|
f := newTeamFixture(t, portal, "portal-svc:*")
|
|
staff := map[string]string{"X-Staff-Subject": "staff-1", "X-Staff-Email": "staff@breakpilot.test"}
|
|
// without a named staff member: reserved like any platform path
|
|
if code, _, raw := f.call(t, "POST", "/v1/tenants", `{"slug":"breakpilot","name":"Breakpilot GmbH"}`, nil); code != http.StatusBadRequest || !strings.Contains(string(raw), "reserved_slug") {
|
|
t.Fatalf("non-staff: %d %s", code, raw)
|
|
}
|
|
// staff may not take other reserved slugs
|
|
if code, _, raw := f.call(t, "POST", "/v1/tenants", `{"slug":"admin","name":"Shadow"}`, staff); code != http.StatusBadRequest || !strings.Contains(string(raw), "reserved_slug") {
|
|
t.Fatalf("staff, admin: %d %s", code, raw)
|
|
}
|
|
// staff may create the company's own workspace
|
|
if code, _, raw := f.call(t, "POST", "/v1/tenants", `{"slug":"breakpilot","name":"Breakpilot GmbH"}`, staff); code != http.StatusCreated {
|
|
t.Fatalf("staff, breakpilot: %d %s", code, raw)
|
|
}
|
|
}
|