Skip to content

Commit 6523dec

Browse files
authored
Merge pull request #708 from tidepool-org/tk/fix-device-logs-route
Change device logs route to device_logs for consistency
2 parents 2f34b10 + 4bbe2f0 commit 6523dec

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

blob/client/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ func (c *Client) CreateDeviceLogs(ctx context.Context, userID string, content *b
121121
mutators = append(mutators, request.NewHeaderMutator("X-Logs-End-At-Time", content.EndAt.Format(time.RFC3339)))
122122
}
123123

124-
url := c.client.ConstructURL("v1", "users", userID, "device-logs")
124+
url := c.client.ConstructURL("v1", "users", userID, "device_logs")
125125
result := &blob.DeviceLogsBlob{}
126126
if err := c.client.RequestData(ctx, http.MethodPost, url, mutators, content.Body, result); err != nil {
127127
return nil, err

blob/service/api/v1/v1.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ func (r *Router) Routes() []*rest.Route {
4444
rest.Post("/v1/users/:userId/blobs", r.Create),
4545
rest.Delete("/v1/users/:userId/blobs", r.DeleteAll),
4646

47-
rest.Post("/v1/users/:userId/device-logs", r.CreateDeviceLogs),
48-
rest.Get("/v1/users/:userId/device-logs", r.ListDeviceLogs),
47+
rest.Post("/v1/users/:userId/device_logs", r.CreateDeviceLogs),
48+
rest.Get("/v1/users/:userId/device_logs", r.ListDeviceLogs),
4949

5050
rest.Get("/v1/blobs/:id", r.Get),
5151
rest.Get("/v1/blobs/:id/content", r.GetContent),

blob/service/api/v1/v1_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,8 @@ var _ = Describe("V1", func() {
8181
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodGet), "PathExp": Equal("/v1/users/:userId/blobs")})),
8282
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodPost), "PathExp": Equal("/v1/users/:userId/blobs")})),
8383
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodDelete), "PathExp": Equal("/v1/users/:userId/blobs")})),
84-
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodPost), "PathExp": Equal("/v1/users/:userId/device-logs")})),
85-
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodGet), "PathExp": Equal("/v1/users/:userId/device-logs")})),
84+
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodPost), "PathExp": Equal("/v1/users/:userId/device_logs")})),
85+
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodGet), "PathExp": Equal("/v1/users/:userId/device_logs")})),
8686
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodGet), "PathExp": Equal("/v1/blobs/:id")})),
8787
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodGet), "PathExp": Equal("/v1/blobs/:id/content")})),
8888
PointTo(MatchFields(IgnoreExtras, Fields{"HttpMethod": Equal(http.MethodDelete), "PathExp": Equal("/v1/blobs/:id")})),
@@ -326,7 +326,7 @@ var _ = Describe("V1", func() {
326326
Context("ListDeviceLogs", func() {
327327
BeforeEach(func() {
328328
req.Method = http.MethodGet
329-
req.URL.Path = fmt.Sprintf("/v1/users/%s/device-logs", userID)
329+
req.URL.Path = fmt.Sprintf("/v1/users/%s/device_logs", userID)
330330
})
331331

332332
It("panics when the response is missing", func() {
@@ -593,7 +593,7 @@ var _ = Describe("V1", func() {
593593
Context("CreateDeviceLogs", func() {
594594
BeforeEach(func() {
595595
req.Method = http.MethodPost
596-
req.URL.Path = fmt.Sprintf("/v1/users/%s/device-logs", userID)
596+
req.URL.Path = fmt.Sprintf("/v1/users/%s/device_logs", userID)
597597
})
598598

599599
It("panics when the response is missing", func() {
@@ -615,7 +615,7 @@ var _ = Describe("V1", func() {
615615

616616
When("the path does not contain a user id", func() {
617617
BeforeEach(func() {
618-
req.URL.Path = "/v1/users//device-logs"
618+
req.URL.Path = "/v1/users//device_logs"
619619
})
620620

621621
It("responds with bad request and expected error in body", func() {
@@ -628,7 +628,7 @@ var _ = Describe("V1", func() {
628628

629629
When("the path contains an invalid user id", func() {
630630
BeforeEach(func() {
631-
req.URL.Path = "/v1/users/invalid/device-logs"
631+
req.URL.Path = "/v1/users/invalid/device_logs"
632632
})
633633

634634
It("responds with bad request and expected error in body", func() {

blob/service/client/client_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -396,7 +396,7 @@ var _ = Describe("Client", func() {
396396
Expect(result).To(BeNil())
397397
})
398398

399-
When("the device-logs blob is created", func() {
399+
When("the device_logs blob is created", func() {
400400
AfterEach(func() {
401401
structuredCreate := blobStoreStructured.NewCreate()
402402
structuredCreate.MediaType = content.MediaType

0 commit comments

Comments
 (0)