Skip to content

Commit

Permalink
Fix: failing tests
Browse files Browse the repository at this point in the history
Signed-off-by: JeffMboya <jangina.mboya@gmail.com>

Fix: failing tests

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>

Fix: failing tests

Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
  • Loading branch information
JeffMboya committed May 22, 2024
1 parent 1abd27a commit 7f0278b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 20 deletions.
23 changes: 10 additions & 13 deletions bootstrap/api/requests_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ import (
)

func TestAddReqValidation(t *testing.T) {
const (
channel1 = "e4d2aaaf-23f5-45e3-a713-f6cbdc2c9d9d"
channel2 = "77bc4ac6-42f2-4385-af1d-c60408197940"
)

cases := []struct {
desc string
token string
Expand All @@ -22,43 +27,35 @@ func TestAddReqValidation(t *testing.T) {
err error
}{
{
desc: "empty key",
desc: "empty token",
token: "",
externalID: "external-id",
externalKey: "external-key",
channels: []string{"channel1", "channel2"},
channels: []string{channel1, channel2},
err: apiutil.ErrBearerToken,
},
{
desc: "empty external ID",
token: "token",
externalID: "",
externalKey: "external-key",
channels: []string{"channel1", "channel2"},
channels: []string{channel1, channel2},
err: apiutil.ErrMissingID,
},
{
desc: "empty external key",
token: "token",
externalID: "external-id",
externalKey: "",
channels: []string{"channel1", "channel2"},
channels: []string{channel1, channel2},
err: apiutil.ErrBearerKey,
},
{
desc: "empty external key and external ID",
token: "token",
externalID: "",
externalKey: "",
channels: []string{"channel1", "channel2"},
err: apiutil.ErrMissingID,
},
{
desc: "invalid channel",
token: "token",
externalID: "external-id",
externalKey: "external-key",
channels: []string{"invalid"},
channels: []string{channel1, channel2},
err: apiutil.ErrMissingID,
},
{
Expand Down
15 changes: 8 additions & 7 deletions bootstrap/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,13 +143,14 @@ func TestAdd(t *testing.T) {
err: svcerr.ErrAuthentication,
},
{
desc: "add a config with invalid list of channels",
config: wrongChannels,
token: validToken,
id: validID,
domain: domainID,
authResponse: &magistrala.AuthorizeRes{Authorized: true},
err: nil,
desc: "add a config with invalid list of channels",
config: wrongChannels,
token: validToken,
id: validID,
domain: domainID,
authResponse: &magistrala.AuthorizeRes{Authorized: true},
listExistingErr: svcerr.ErrMalformedEntity,
err: svcerr.ErrMalformedEntity,
},
{
desc: "add ampty config",
Expand Down

0 comments on commit 7f0278b

Please sign in to comment.