Skip to content

Commit

Permalink
Rename DAM config claimDefinitions endpoint
Browse files Browse the repository at this point in the history
Becomes "visaTypes" to match the name within the config file.

PiperOrigin-RevId: 299453261
Change-Id: Ia08c10567c85fead7a6ddf47b0b60a8ee935c2c7
  • Loading branch information
cdvoisin authored and copybara-github committed Mar 6, 2020
1 parent 4b5a9d2 commit 7a3bfc7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion lib/dam/configadmin.go
Original file line number Diff line number Diff line change
Expand Up @@ -674,7 +674,7 @@ func (h *configPolicyHandler) Save(r *http.Request, tx storage.Tx, name string,
func (s *Service) configVisaTypeFactory() *handlerfactory.Options {
return &handlerfactory.Options{
TypeName: "configVisaType",
PathPrefix: configClaimDefPath,
PathPrefix: configVisaTypePath,
HasNamedIdentifiers: true,
Service: NewConfigVisaTypeHandler(s),
}
Expand Down
2 changes: 1 addition & 1 deletion lib/dam/dam.go
Original file line number Diff line number Diff line change
Expand Up @@ -1378,7 +1378,7 @@ func registerHandlers(r *mux.Router, s *Service) {
r.HandleFunc(configTrustedIssuerPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configIssuerFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configTrustedSourcePath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configSourceFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configPolicyPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configPolicyFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configClaimDefPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configVisaTypeFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configVisaTypePath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configVisaTypeFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configServiceTemplatePath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configServiceTemplateFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configTestPersonaPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configPersonaFactory()), checker, auth.RequireAdminToken))
r.HandleFunc(configClientPath, auth.MustWithAuth(handlerfactory.MakeHandler(s.GetStore(), s.configClientFactory()), checker, auth.RequireAdminToken))
Expand Down
52 changes: 26 additions & 26 deletions lib/dam/dam_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ func TestHandlers(t *testing.T) {
t.Fatalf("fakeoidcissuer.New(%q, _, _) failed: %v", hydraPublicURL, err)
}
s := NewService(&Options{
HTTPClient: server.Client(),
Domain: "test.org",
ServiceName: "dam",
DefaultBroker: "no-broker",
Store: store,
Warehouse: wh,
UseHydra: useHydra,
HydraAdminURL: hydraAdminURL,
HydraPublicURL: hydraPublicURL,
HydraSyncFreq: time.Nanosecond,
HTTPClient: server.Client(),
Domain: "test.org",
ServiceName: "dam",
DefaultBroker: "no-broker",
Store: store,
Warehouse: wh,
UseHydra: useHydra,
HydraAdminURL: hydraAdminURL,
HydraPublicURL: hydraPublicURL,
HydraSyncFreq: time.Nanosecond,
})
tests := []test.HandlerTest{
// Realm tests.
Expand Down Expand Up @@ -575,36 +575,36 @@ func TestHandlers(t *testing.T) {
},
{
Method: "GET",
Path: "/dam/v1alpha/test/config/claimDefinitions/ResearcherStatus",
Path: "/dam/v1alpha/test/config/visaTypes/ResearcherStatus",
Persona: "admin",
Output: `^.*"ui"`,
Status: http.StatusOK,
},
{
Method: "POST",
Path: "/dam/v1alpha/test/config/claimDefinitions/new.claim",
Path: "/dam/v1alpha/test/config/visaTypes/new.claim",
Persona: "admin",
Input: `{"item":{"ui":{"label":"new.Claim","description":"bar"}}}`,
Output: ``,
Status: http.StatusOK,
},
{
Method: "PUT",
Path: "/dam/v1alpha/test/config/claimDefinitions/new.claim",
Path: "/dam/v1alpha/test/config/visaTypes/new.claim",
Persona: "admin",
Input: `{"item":{"ui":{"label":"new.Claim2","description":"bar"}}}`,
Status: http.StatusOK,
},
{
Method: "PATCH",
Path: "/dam/v1alpha/test/config/claimDefinitions/new.claim",
Path: "/dam/v1alpha/test/config/visaTypes/new.claim",
Persona: "admin",
Input: `{"item":{"ui":{"label":"new.Claim3","description":"bar"}}}`,
Status: http.StatusOK,
},
{
Method: "DELETE",
Path: "/dam/v1alpha/test/config/claimDefinitions/new.claim",
Path: "/dam/v1alpha/test/config/visaTypes/new.claim",
Persona: "admin",
Output: ``,
Status: http.StatusOK,
Expand Down Expand Up @@ -889,17 +889,17 @@ func TestMinConfig(t *testing.T) {
t.Fatalf("fakeoidcissuer.New(%q, _, _) failed: %v", hydraPublicURL, err)
}
opts := &Options{
HTTPClient: server.Client(),
Domain: "test.org",
ServiceName: "dam",
DefaultBroker: "no-broker",
Store: store,
Warehouse: nil,
UseHydra: useHydra,
HydraAdminURL: hydraAdminURL,
HydraPublicURL: hydraPublicURL,
HidePolicyBasis: true,
HideRejectDetail: true,
HTTPClient: server.Client(),
Domain: "test.org",
ServiceName: "dam",
DefaultBroker: "no-broker",
Store: store,
Warehouse: nil,
UseHydra: useHydra,
HydraAdminURL: hydraAdminURL,
HydraPublicURL: hydraPublicURL,
HidePolicyBasis: true,
HideRejectDetail: true,
}
s := NewService(opts)
verifyService(t, s.domainURL, opts.Domain, "domainURL")
Expand Down
2 changes: 1 addition & 1 deletion lib/dam/endpoints.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const (
configTrustedSourcePath = "/dam/v1alpha/{realm}/config/trustedSources/{name}"
configPolicyPath = "/dam/v1alpha/{realm}/config/policies/{name}"
configOptionsPath = "/dam/v1alpha/{realm}/config/options"
configClaimDefPath = "/dam/v1alpha/{realm}/config/claimDefinitions/{name}"
configVisaTypePath = "/dam/v1alpha/{realm}/config/visaTypes/{name}"
configServiceTemplatePath = "/dam/v1alpha/{realm}/config/serviceTemplates/{name}"
configClientPath = "/dam/v1alpha/{realm}/config/clients/{name}"
configTestPersonasPath = "/dam/v1alpha/{realm}/config/testPersonas"
Expand Down

0 comments on commit 7a3bfc7

Please sign in to comment.