@@ -2,6 +2,7 @@ package mockapi
22
33import (
44 "encoding/json"
5+ "fmt"
56 "net/http"
67 "net/url"
78 "time"
@@ -17,11 +18,14 @@ func (h *Handler) handleCreateSubscription(w http.ResponseWriter, req *http.Requ
1718 }{}
1819 err := json .NewDecoder (req .Body ).Decode (& createOptions )
1920 require .NoError (h .t , err )
21+ orgID := chi .URLParam (req , "organization_id" )
2022 id := NumericID ()
2123 projectID := ProjectID ()
2224 sub := Subscription {
23- ID : id ,
24- Links : MakeHALLinks ("self=" + "/subscriptions/" + url .PathEscape (id )),
25+ ID : id ,
26+ Links : MakeHALLinks (
27+ "self=" + "/organizations/" + url .PathEscape (orgID ) + "/subscriptions/" + url .PathEscape (id ),
28+ ),
2529 ProjectRegion : createOptions .Region ,
2630 ProjectTitle : createOptions .Title ,
2731 Status : "provisioning" ,
@@ -40,7 +44,10 @@ func (h *Handler) handleCreateSubscription(w http.ResponseWriter, req *http.Requ
4044 Links : MakeHALLinks ("self=/projects/" + projectID ),
4145 Repository : ProjectRepository {URL : projectID + "@git.example.com:" + projectID + ".git" },
4246 SubscriptionID : sub .ID ,
43- Organization : chi .URLParam (req , "organization_id" ),
47+ Subscription : ProjectSubscriptionInfo {
48+ LicenseURI : fmt .Sprintf ("/licenses/%s" , url .PathEscape (sub .ID )),
49+ },
50+ Organization : chi .URLParam (req , "organization_id" ),
4451 }
4552 h .store .Unlock ()
4653
0 commit comments