Skip to content

Commit

Permalink
refactor: Rename functions
Browse files Browse the repository at this point in the history
Signed-off-by: 1998-felix <[email protected]>
  • Loading branch information
felixgateru committed Apr 4, 2024
1 parent d4d45ac commit f77dee9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
24 changes: 12 additions & 12 deletions things/api/http/endpoints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2198,7 +2198,7 @@ func TestUnassignUsers(t *testing.T) {
}
}

func TestAssignUserGroups(t *testing.T) {
func TestAssignGroupsToChannel(t *testing.T) {
ts, _, gsvc := newThingsServer()
defer ts.Close()

Expand Down Expand Up @@ -2308,7 +2308,7 @@ func TestAssignUserGroups(t *testing.T) {
}
}

func TestUnassignUserGroups(t *testing.T) {
func TestUnassignGroupsFromChannel(t *testing.T) {
ts, _, gsvc := newThingsServer()
defer ts.Close()

Expand Down Expand Up @@ -2418,7 +2418,7 @@ func TestUnassignUserGroups(t *testing.T) {
}
}

func TestConnectChannelThing(t *testing.T) {
func TestConnectThingToChannel(t *testing.T) {
ts, _, gsvc := newThingsServer()
defer ts.Close()

Expand Down Expand Up @@ -2455,7 +2455,7 @@ func TestConnectChannelThing(t *testing.T) {
channelID: "",
thingID: validID,
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand All @@ -2464,7 +2464,7 @@ func TestConnectChannelThing(t *testing.T) {
channelID: validID,
thingID: "",
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
}
Expand All @@ -2485,7 +2485,7 @@ func TestConnectChannelThing(t *testing.T) {
}
}

func TestDisconnectChannelThing(t *testing.T) {
func TestDisconnectThingFromChannel(t *testing.T) {
ts, _, gsvc := newThingsServer()
defer ts.Close()

Expand Down Expand Up @@ -2522,7 +2522,7 @@ func TestDisconnectChannelThing(t *testing.T) {
channelID: "",
thingID: validID,
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand All @@ -2531,7 +2531,7 @@ func TestDisconnectChannelThing(t *testing.T) {
channelID: validID,
thingID: "",
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
}
Expand Down Expand Up @@ -2594,7 +2594,7 @@ func TestConnect(t *testing.T) {
ThingID: validID,
},
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand All @@ -2605,7 +2605,7 @@ func TestConnect(t *testing.T) {
ThingID: "",
},
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand Down Expand Up @@ -2691,7 +2691,7 @@ func TestDisconnect(t *testing.T) {
ThingID: validID,
},
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand All @@ -2702,7 +2702,7 @@ func TestDisconnect(t *testing.T) {
ThingID: "",
},
contentType: contentType,
status: http.StatusUnprocessableEntity,
status: http.StatusBadRequest,
err: apiutil.ErrValidation,
},
{
Expand Down
4 changes: 2 additions & 2 deletions things/api/http/requests.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,7 @@ type connectChannelThingRequest struct {

func (req *connectChannelThingRequest) validate() error {
if req.ThingID == "" || req.ChannelID == "" {
return svcerr.ErrCreateEntity
return apiutil.ErrMissingID
}
return nil
}
Expand All @@ -324,7 +324,7 @@ type disconnectChannelThingRequest struct {

func (req *disconnectChannelThingRequest) validate() error {
if req.ThingID == "" || req.ChannelID == "" {
return svcerr.ErrCreateEntity
return apiutil.ErrMissingID
}
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions things/api/http/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ func TestConnectChannelThingRequestValidate(t *testing.T) {
ChannelID: "",
ThingID: validID,
},
err: svcerr.ErrCreateEntity,
err: apiutil.ErrMissingID,
},
{
desc: "empty thing id",
Expand All @@ -741,7 +741,7 @@ func TestConnectChannelThingRequestValidate(t *testing.T) {
ChannelID: validID,
ThingID: "",
},
err: svcerr.ErrCreateEntity,
err: apiutil.ErrMissingID,
},
}
for _, c := range cases {
Expand Down Expand Up @@ -772,7 +772,7 @@ func TestDisconnectChannelThingRequestValidate(t *testing.T) {
ChannelID: "",
ThingID: validID,
},
err: svcerr.ErrCreateEntity,
err: apiutil.ErrMissingID,
},
{
desc: "empty thing id",
Expand All @@ -781,7 +781,7 @@ func TestDisconnectChannelThingRequestValidate(t *testing.T) {
ChannelID: validID,
ThingID: "",
},
err: svcerr.ErrCreateEntity,
err: apiutil.ErrMissingID,
},
}
for _, c := range cases {
Expand Down

0 comments on commit f77dee9

Please sign in to comment.