mirror of
https://github.com/mainflux/mainflux.git
synced 2025-04-24 13:48:49 +08:00
NOISSUE - Fix Linting (#1938)
* Fix linting Signed-off-by: rodneyosodo <blackd0t@protonmail.com> * Remove parentID when creating groups Signed-off-by: rodneyosodo <blackd0t@protonmail.com> --------- Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
This commit is contained in:
parent
fa00c82b98
commit
6da9a5da21
@ -405,7 +405,7 @@ func (svc service) authenticate(token string) (string, string, error) {
|
||||
return key.Issuer, key.Subject, nil
|
||||
}
|
||||
|
||||
// Switch the relative permission for the relation
|
||||
// Switch the relative permission for the relation.
|
||||
func SwitchToPermission(relation string) string {
|
||||
switch relation {
|
||||
case OwnerRelation:
|
||||
|
@ -13,14 +13,12 @@ import (
|
||||
mfclients "github.com/mainflux/mainflux/pkg/clients"
|
||||
"github.com/mainflux/mainflux/pkg/errors"
|
||||
mfgroups "github.com/mainflux/mainflux/pkg/groups"
|
||||
"github.com/mainflux/mainflux/pkg/uuid"
|
||||
cpostgres "github.com/mainflux/mainflux/users/postgres"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
var (
|
||||
idProvider = uuid.New()
|
||||
password = "$tr0ngPassw0rd"
|
||||
clientIdentity = "client-identity@example.com"
|
||||
clientName = "client name"
|
||||
@ -33,7 +31,7 @@ func TestClientsRetrieveByID(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: clientName,
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: clientIdentity,
|
||||
@ -71,7 +69,7 @@ func TestClientsRetrieveByIdentity(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: clientName,
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: clientIdentity,
|
||||
@ -103,7 +101,7 @@ func TestClientsRetrieveAll(t *testing.T) {
|
||||
grepo := gpostgres.New(database)
|
||||
|
||||
nClients := uint64(200)
|
||||
ownerID := testsutil.GenerateUUID(t, idProvider)
|
||||
ownerID := testsutil.GenerateUUID(t)
|
||||
|
||||
meta := mfclients.Metadata{
|
||||
"admin": "true",
|
||||
@ -114,7 +112,7 @@ func TestClientsRetrieveAll(t *testing.T) {
|
||||
expectedClients := []mfclients.Client{}
|
||||
|
||||
sharedGroup := mfgroups.Group{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "shared-group",
|
||||
}
|
||||
_, err := grepo.Save(context.Background(), sharedGroup)
|
||||
@ -123,7 +121,7 @@ func TestClientsRetrieveAll(t *testing.T) {
|
||||
for i := uint64(0); i < nClients; i++ {
|
||||
identity := fmt.Sprintf("TestRetrieveAll%d@example.com", i)
|
||||
client := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: identity,
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: identity,
|
||||
@ -388,7 +386,7 @@ func TestClientsUpdateMetadata(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update@example.com",
|
||||
@ -402,7 +400,7 @@ func TestClientsUpdateMetadata(t *testing.T) {
|
||||
}
|
||||
|
||||
client2 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "disabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client2-update@example.com",
|
||||
@ -544,7 +542,7 @@ func TestClientsUpdateTags(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client-with-tags",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update-tags@example.com",
|
||||
@ -554,7 +552,7 @@ func TestClientsUpdateTags(t *testing.T) {
|
||||
Status: mfclients.EnabledStatus,
|
||||
}
|
||||
client2 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "disabled-client-with-tags",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client2-update-tags@example.com",
|
||||
@ -620,7 +618,7 @@ func TestClientsUpdateSecret(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update@example.com",
|
||||
@ -629,7 +627,7 @@ func TestClientsUpdateSecret(t *testing.T) {
|
||||
Status: mfclients.EnabledStatus,
|
||||
}
|
||||
client2 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "disabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client2-update@example.com",
|
||||
@ -704,7 +702,7 @@ func TestClientsUpdateIdentity(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update@example.com",
|
||||
@ -713,7 +711,7 @@ func TestClientsUpdateIdentity(t *testing.T) {
|
||||
Status: mfclients.EnabledStatus,
|
||||
}
|
||||
client2 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "disabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client2-update@example.com",
|
||||
@ -783,23 +781,23 @@ func TestClientsUpdateOwner(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client-with-owner",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update-owner@example.com",
|
||||
Secret: password,
|
||||
},
|
||||
Owner: testsutil.GenerateUUID(t, idProvider),
|
||||
Owner: testsutil.GenerateUUID(t),
|
||||
Status: mfclients.EnabledStatus,
|
||||
}
|
||||
client2 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "disabled-client-with-owner",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client2-update-owner@example.com",
|
||||
Secret: password,
|
||||
},
|
||||
Owner: testsutil.GenerateUUID(t, idProvider),
|
||||
Owner: testsutil.GenerateUUID(t),
|
||||
Status: mfclients.DisabledStatus,
|
||||
}
|
||||
|
||||
@ -824,7 +822,7 @@ func TestClientsUpdateOwner(t *testing.T) {
|
||||
desc: "update owner for enabled client",
|
||||
client: mfclients.Client{
|
||||
ID: client1.ID,
|
||||
Owner: testsutil.GenerateUUID(t, idProvider),
|
||||
Owner: testsutil.GenerateUUID(t),
|
||||
},
|
||||
err: nil,
|
||||
},
|
||||
@ -832,7 +830,7 @@ func TestClientsUpdateOwner(t *testing.T) {
|
||||
desc: "update owner for disabled client",
|
||||
client: mfclients.Client{
|
||||
ID: client2.ID,
|
||||
Owner: testsutil.GenerateUUID(t, idProvider),
|
||||
Owner: testsutil.GenerateUUID(t),
|
||||
},
|
||||
err: errors.ErrNotFound,
|
||||
},
|
||||
@ -840,7 +838,7 @@ func TestClientsUpdateOwner(t *testing.T) {
|
||||
desc: "update owner for invalid client",
|
||||
client: mfclients.Client{
|
||||
ID: wrongID,
|
||||
Owner: testsutil.GenerateUUID(t, idProvider),
|
||||
Owner: testsutil.GenerateUUID(t),
|
||||
},
|
||||
err: errors.ErrNotFound,
|
||||
},
|
||||
@ -859,7 +857,7 @@ func TestClientsChangeStatus(t *testing.T) {
|
||||
repo := cpostgres.NewRepository(database)
|
||||
|
||||
client1 := mfclients.Client{
|
||||
ID: testsutil.GenerateUUID(t, idProvider),
|
||||
ID: testsutil.GenerateUUID(t),
|
||||
Name: "enabled-client",
|
||||
Credentials: mfclients.Credentials{
|
||||
Identity: "client1-update@example.com",
|
||||
|
@ -90,7 +90,7 @@ func TestCreateChannel(t *testing.T) {
|
||||
desc: "create channel with parent",
|
||||
channel: sdk.Channel{
|
||||
Name: gName,
|
||||
ParentID: testsutil.GenerateUUID(t, idProvider),
|
||||
ParentID: testsutil.GenerateUUID(t),
|
||||
Status: mfclients.EnabledStatus.String(),
|
||||
},
|
||||
err: nil,
|
||||
@ -596,7 +596,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with authorized token",
|
||||
token: adminToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{},
|
||||
response: aChannels,
|
||||
err: nil,
|
||||
@ -604,7 +604,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with offset and limit",
|
||||
token: adminToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Offset: 6,
|
||||
Total: nChannels,
|
||||
@ -617,7 +617,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with given name",
|
||||
token: adminToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Name: gName,
|
||||
Offset: 6,
|
||||
@ -631,7 +631,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with given level",
|
||||
token: adminToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Level: 1,
|
||||
Offset: 6,
|
||||
@ -645,7 +645,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with metadata",
|
||||
token: adminToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Metadata: validMetadata,
|
||||
Offset: 6,
|
||||
@ -659,7 +659,7 @@ func TestListChannelsByThing(t *testing.T) {
|
||||
{
|
||||
desc: "list channel with an invalid token",
|
||||
token: invalidToken,
|
||||
clientID: testsutil.GenerateUUID(t, idProvider),
|
||||
clientID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{},
|
||||
response: []sdk.Channel(nil),
|
||||
err: errors.NewSDKErrorWithStatus(errors.Wrap(errors.ErrAuthorization, errors.ErrAuthentication), http.StatusUnauthorized),
|
||||
|
@ -77,7 +77,7 @@ func TestCreateGroup(t *testing.T) {
|
||||
desc: "create group with parent",
|
||||
group: sdk.Group{
|
||||
Name: gName,
|
||||
ParentID: testsutil.GenerateUUID(t, idProvider),
|
||||
ParentID: testsutil.GenerateUUID(t),
|
||||
Status: clients.EnabledStatus.String(),
|
||||
},
|
||||
err: nil,
|
||||
|
@ -487,7 +487,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with authorized token",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{},
|
||||
response: aThings,
|
||||
err: nil,
|
||||
@ -495,7 +495,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with offset and limit",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Offset: 4,
|
||||
Limit: nThing,
|
||||
@ -506,7 +506,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with given name",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Name: Identity,
|
||||
Offset: 6,
|
||||
@ -519,7 +519,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with given ownerID",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
OwnerID: user.Owner,
|
||||
Offset: 6,
|
||||
@ -531,7 +531,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with given subject",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Subject: subject,
|
||||
Offset: 6,
|
||||
@ -543,7 +543,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with given object",
|
||||
token: adminToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{
|
||||
Object: object,
|
||||
Offset: 6,
|
||||
@ -555,7 +555,7 @@ func TestListThingsByChannel(t *testing.T) {
|
||||
{
|
||||
desc: "list things with an invalid token",
|
||||
token: invalidToken,
|
||||
channelID: testsutil.GenerateUUID(t, idProvider),
|
||||
channelID: testsutil.GenerateUUID(t),
|
||||
page: sdk.PageMetadata{},
|
||||
response: []sdk.Thing(nil),
|
||||
err: errors.NewSDKErrorWithStatus(errors.ErrAuthentication, http.StatusUnauthorized),
|
||||
@ -955,11 +955,11 @@ func TestEnableThing(t *testing.T) {
|
||||
}
|
||||
mfsdk := sdk.NewSDK(conf)
|
||||
|
||||
enabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: generateUUID(t)}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: generateUUID(t)}, Status: mfclients.DisabledStatus.String()}
|
||||
enabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: generateUUID(t)}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: generateUUID(t)}, Status: mfclients.DisabledStatus.String()}
|
||||
endisabledThing1 := disabledThing1
|
||||
endisabledThing1.Status = mfclients.EnabledStatus.String()
|
||||
endisabledThing1.ID = testsutil.GenerateUUID(t, idProvider)
|
||||
endisabledThing1.ID = testsutil.GenerateUUID(t)
|
||||
|
||||
cases := []struct {
|
||||
desc string
|
||||
@ -1076,11 +1076,11 @@ func TestDisableThing(t *testing.T) {
|
||||
}
|
||||
mfsdk := sdk.NewSDK(conf)
|
||||
|
||||
enabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: generateUUID(t)}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: generateUUID(t)}, Status: mfclients.DisabledStatus.String()}
|
||||
enabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: generateUUID(t)}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledThing1 := sdk.Thing{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: generateUUID(t)}, Status: mfclients.DisabledStatus.String()}
|
||||
disenabledThing1 := enabledThing1
|
||||
disenabledThing1.Status = mfclients.DisabledStatus.String()
|
||||
disenabledThing1.ID = testsutil.GenerateUUID(t, idProvider)
|
||||
disenabledThing1.ID = testsutil.GenerateUUID(t)
|
||||
|
||||
cases := []struct {
|
||||
desc string
|
||||
|
@ -917,11 +917,11 @@ func TestEnableClient(t *testing.T) {
|
||||
}
|
||||
mfsdk := sdk.NewSDK(conf)
|
||||
|
||||
enabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: "password"}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: "password"}, Status: mfclients.DisabledStatus.String()}
|
||||
enabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: "password"}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: "password"}, Status: mfclients.DisabledStatus.String()}
|
||||
endisabledClient1 := disabledClient1
|
||||
endisabledClient1.Status = mfclients.EnabledStatus.String()
|
||||
endisabledClient1.ID = testsutil.GenerateUUID(t, idProvider)
|
||||
endisabledClient1.ID = testsutil.GenerateUUID(t)
|
||||
|
||||
cases := []struct {
|
||||
desc string
|
||||
@ -1042,11 +1042,11 @@ func TestDisableClient(t *testing.T) {
|
||||
}
|
||||
mfsdk := sdk.NewSDK(conf)
|
||||
|
||||
enabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: "password"}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t, idProvider), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: "password"}, Status: mfclients.DisabledStatus.String()}
|
||||
enabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client1@example.com", Secret: "password"}, Status: mfclients.EnabledStatus.String()}
|
||||
disabledClient1 := sdk.User{ID: testsutil.GenerateUUID(t), Credentials: sdk.Credentials{Identity: "client3@example.com", Secret: "password"}, Status: mfclients.DisabledStatus.String()}
|
||||
disenabledClient1 := enabledClient1
|
||||
disenabledClient1.Status = mfclients.DisabledStatus.String()
|
||||
disenabledClient1.ID = testsutil.GenerateUUID(t, idProvider)
|
||||
disenabledClient1.ID = testsutil.GenerateUUID(t)
|
||||
|
||||
cases := []struct {
|
||||
desc string
|
||||
|
@ -186,11 +186,9 @@ func createGroups(s sdk.SDK, conf Config, token string) ([]sdk.Group, error) {
|
||||
var err error
|
||||
groups := []sdk.Group{}
|
||||
|
||||
parentID := ""
|
||||
for i := uint64(0); i < conf.Num; i++ {
|
||||
group := sdk.Group{
|
||||
Name: fmt.Sprintf("%s-%s", conf.Prefix, namesgenerator.Generate()),
|
||||
ParentID: parentID,
|
||||
Status: sdk.EnabledStatus,
|
||||
}
|
||||
|
||||
@ -199,7 +197,6 @@ func createGroups(s sdk.SDK, conf Config, token string) ([]sdk.Group, error) {
|
||||
return []sdk.Group{}, fmt.Errorf("failed to create the group: %w", err)
|
||||
}
|
||||
groups = append(groups, group)
|
||||
parentID = group.ID
|
||||
}
|
||||
|
||||
return groups, nil
|
||||
|
@ -12,7 +12,6 @@ import (
|
||||
"github.com/mainflux/mainflux/internal/testsutil"
|
||||
mfclients "github.com/mainflux/mainflux/pkg/clients"
|
||||
"github.com/mainflux/mainflux/pkg/errors"
|
||||
"github.com/mainflux/mainflux/pkg/uuid"
|
||||
cpostgres "github.com/mainflux/mainflux/users/postgres"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
@ -23,7 +22,6 @@ const (
|
||||
)
|
||||
|
||||
var (
|
||||
idProvider = uuid.New()
|
||||
invalidName = strings.Repeat("m", maxNameSize+10)
|
||||
password = "$tr0ngPassw0rd"
|
||||
clientIdentity = "client-identity@example.com"
|
||||
|
@ -476,6 +476,7 @@ func (svc service) updateOwnerPolicy(ctx context.Context, previousOwnerID, owner
|
||||
}
|
||||
return svc.addOwnerPolicy(ctx, ownerID, userID)
|
||||
}
|
||||
|
||||
func (svc service) addOwnerPolicy(ctx context.Context, ownerID, userID string) error {
|
||||
if ownerID != "" {
|
||||
if _, err := svc.auth.AddPolicy(ctx, &mainflux.AddPolicyReq{
|
||||
|
Loading…
x
Reference in New Issue
Block a user