Skip to content
This repository has been archived by the owner on Aug 31, 2021. It is now read-only.

Commit

Permalink
Update rts stack get url (#112)
Browse files Browse the repository at this point in the history
* Update rts stack get url

* add id to stack get function

* Fix tests

* Fix acc tests
  • Loading branch information
niuzhenguo committed Jan 25, 2019
1 parent a692be3 commit fe19c45
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions openstack/rts/v1/stacks/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,8 +206,8 @@ func getStructField(v *ListedStack, field string) string {
return string(f.String())
}

func Get(c *golangsdk.ServiceClient, stackName string) (r GetResult) {
_, r.Err = c.Get(getURL(c, stackName), &r.Body, nil)
func Get(c *golangsdk.ServiceClient, stackName, stackID string) (r GetResult) {
_, r.Err = c.Get(getURL(c, stackName, stackID), &r.Body, nil)
return
}

Expand Down
2 changes: 1 addition & 1 deletion openstack/rts/v1/stacks/testing/fixtures.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ const GetOutput = `
// HandleGetSuccessfully creates an HTTP handler at `/stacks/postman_stack/16ef0584-4458-41eb-87c8-0dc8d5f66c87`
// on the test handler mux that responds with a `Get` response.
func HandleGetSuccessfully(t *testing.T, output string) {
th.Mux.HandleFunc("/stacks/postman_stack", func(w http.ResponseWriter, r *http.Request) {
th.Mux.HandleFunc("/stacks/postman_stack/db6977b2-27aa-4775-9ae7-6213212d4ada", func(w http.ResponseWriter, r *http.Request) {
th.TestMethod(t, r, "GET")
th.TestHeader(t, r, "X-Auth-Token", fake.TokenID)
th.TestHeader(t, r, "Accept", "application/json")
Expand Down
2 changes: 1 addition & 1 deletion openstack/rts/v1/stacks/testing/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func TestGetStack(t *testing.T) {
defer th.TeardownHTTP()
HandleGetSuccessfully(t, GetOutput)

actual, err := stacks.Get(fake.ServiceClient(), "postman_stack").Extract()
actual, err := stacks.Get(fake.ServiceClient(), "postman_stack", "db6977b2-27aa-4775-9ae7-6213212d4ada").Extract()
th.AssertNoErr(t, err)

expected := GetExpected
Expand Down
4 changes: 2 additions & 2 deletions openstack/rts/v1/stacks/urls.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ func listURL(c *golangsdk.ServiceClient) string {
return createURL(c)
}

func getURL(c *golangsdk.ServiceClient, name string) string {
return c.ServiceURL("stacks", name)
func getURL(c *golangsdk.ServiceClient, name, id string) string {
return c.ServiceURL("stacks", name, id)
}
func updateURL(c *golangsdk.ServiceClient, name, id string) string {
return c.ServiceURL("stacks", name, id)
Expand Down

0 comments on commit fe19c45

Please sign in to comment.