Skip to content

Commit

Permalink
Merge branch 'main' into denopink/patch/mocktr181-rework-get
Browse files Browse the repository at this point in the history
  • Loading branch information
schmidtw authored Jul 18, 2024
2 parents 9e5f3a0 + 7cfc425 commit d103132
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ require (
github.com/stretchr/testify v1.9.0
github.com/ugorji/go/codec v1.2.12
github.com/xmidt-org/arrange v0.5.0
github.com/xmidt-org/eventor v1.0.9
github.com/xmidt-org/eventor v1.0.10
github.com/xmidt-org/retry v0.0.3
github.com/xmidt-org/sallust v0.2.2
github.com/xmidt-org/wrp-go/v3 v3.5.2
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65E
github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
github.com/xmidt-org/arrange v0.5.0 h1:ajkVHkr7dXnfCYm/6eafWoOab+6A3b2jEHQO0IdIIb0=
github.com/xmidt-org/arrange v0.5.0/go.mod h1:PoZB9lR49ma0osydQbaWpNeA3XPoLkjP5RYUoOw8wZU=
github.com/xmidt-org/eventor v1.0.9 h1:uE5VhopMK4rpHWAOpuauTK8lVEc/GFS3f6zP8q4LOWo=
github.com/xmidt-org/eventor v1.0.9/go.mod h1:NpaRwPEiiaB5oEdFI41o6Lf4iQHAVwCdtwKb3z7R8mY=
github.com/xmidt-org/eventor v1.0.10 h1:mmhXAB0OBdY/XxjiHMbC+ARH4iFOB6lNecqe3f+cLzs=
github.com/xmidt-org/eventor v1.0.10/go.mod h1:NpaRwPEiiaB5oEdFI41o6Lf4iQHAVwCdtwKb3z7R8mY=
github.com/xmidt-org/httpaux v0.4.0 h1:cAL/MzIBpSsv4xZZeq/Eu1J5M3vfNe49xr41mP3COKU=
github.com/xmidt-org/httpaux v0.4.0/go.mod h1:UypqZwuZV1nn8D6+K1JDb+im9IZrLNg/2oO/Bgiybxc=
github.com/xmidt-org/retry v0.0.3 h1:wvmBnEEn1OKwSZaQtr1RZ2Vey8JIvP72mGTgR+3wPiM=
Expand Down
3 changes: 2 additions & 1 deletion internal/wrphandlers/mocktr181/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ func (h Handler) HandleWrp(msg wrp.Message) error {

default:
// currently only get and set are implemented for existing mocktr181
statusCode = http.StatusOK
statusCode = 520
payloadResponse = []byte(fmt.Sprintf(`{"message": "command %s is not support"}`, command))
}

response := msg
Expand Down
15 changes: 15 additions & 0 deletions internal/wrphandlers/mocktr181/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,21 @@ func TestHandler_HandleWrp(t *testing.T) {
a.Equal(int64(520), *msg.Status)
a.True(h.Enabled())

return nil
},
}, {
description: "unknown command",
egressCallCount: 1,
msg: wrp.Message{
Type: wrp.SimpleEventMessageType,
Source: "dns:tr1d1um.example.com/service/ignored",
Destination: "event:event_1/ignored",
Payload: []byte("{\"command\":\"FOOBAR\",\"parameters\":[{\"name\":\"Device.Bridging.MaxBridgeEntries\",\"dataType\":0,\"value\":\"anothername\",\"attributes\":{\"notify\":0}}]}"),
},
validate: func(a *assert.Assertions, msg wrp.Message, h *Handler) error {
a.Equal(int64(520), *msg.Status)
a.True(h.Enabled())

return nil
},
},
Expand Down

0 comments on commit d103132

Please sign in to comment.