Skip to content

Commit

Permalink
Fix Linter
Browse files Browse the repository at this point in the history
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
  • Loading branch information
rodneyosodo committed Jun 9, 2023
1 parent 627c1a2 commit 6ab40f5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion consumers/notifiers/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ func TestRemoveSubscription(t *testing.T) {
desc: "test not existing",
token: exampleUser1,
id: "not_exist",
err: nil,
err: errors.ErrNotFound,
},
{
desc: "test with empty token",
Expand Down
18 changes: 10 additions & 8 deletions pkg/sdk/go/policies_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import (
"github.com/stretchr/testify/mock"
)

const addExistingPolicyDesc = "add existing policy"

var (
utadminPolicy = umocks.SubjectSet{Subject: "things", Relation: []string{"g_add"}}
)
Expand Down Expand Up @@ -75,7 +77,7 @@ func TestCreatePolicy(t *testing.T) {
err: nil,
},
{
desc: "add existing policy",
desc: addExistingPolicyDesc,
policy: sdk.Policy{
Subject: subject,
Object: object,
Expand Down Expand Up @@ -163,7 +165,7 @@ func TestCreatePolicy(t *testing.T) {
assert.True(t, ok, fmt.Sprintf("Retrieve was not called on %s", tc.desc))
ok = repoCall2.Parent.AssertCalled(t, "Save", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Save was not called on %s", tc.desc))
if tc.desc == "add existing policy" {
if tc.desc == addExistingPolicyDesc {
ok = repoCall1.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Update was not called on %s", tc.desc))
}
Expand Down Expand Up @@ -316,7 +318,7 @@ func TestAssign(t *testing.T) {
err: nil,
},
{
desc: "add existing policy",
desc: addExistingPolicyDesc,
policy: sdk.Policy{
Subject: subject,
Object: object,
Expand Down Expand Up @@ -404,7 +406,7 @@ func TestAssign(t *testing.T) {
assert.True(t, ok, fmt.Sprintf("Retrieve was not called on %s", tc.desc))
ok = repoCall2.Parent.AssertCalled(t, "Save", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Save was not called on %s", tc.desc))
if tc.desc == "add existing policy" {
if tc.desc == addExistingPolicyDesc {
ok = repoCall1.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Update was not called on %s", tc.desc))
}
Expand Down Expand Up @@ -801,7 +803,7 @@ func TestConnect(t *testing.T) {
err: nil,
},
{
desc: "add existing policy",
desc: addExistingPolicyDesc,
policy: sdk.Policy{
Subject: subject,
Object: object,
Expand Down Expand Up @@ -889,7 +891,7 @@ func TestConnect(t *testing.T) {
assert.True(t, ok, fmt.Sprintf("Retrieve was not called on %s", tc.desc))
ok = repoCall2.Parent.AssertCalled(t, "Save", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Save was not called on %s", tc.desc))
if tc.desc == "add existing policy" {
if tc.desc == addExistingPolicyDesc {
ok = repoCall1.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Update was not called on %s", tc.desc))
}
Expand Down Expand Up @@ -940,7 +942,7 @@ func TestConnectThing(t *testing.T) {
err: nil,
},
{
desc: "add existing policy",
desc: addExistingPolicyDesc,
policy: sdk.Policy{
Subject: subject,
Object: object,
Expand Down Expand Up @@ -1027,7 +1029,7 @@ func TestConnectThing(t *testing.T) {
assert.True(t, ok, fmt.Sprintf("Retrieve was not called on %s", tc.desc))
ok = repoCall2.Parent.AssertCalled(t, "Save", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Save was not called on %s", tc.desc))
if tc.desc == "add existing policy" {
if tc.desc == addExistingPolicyDesc {
ok = repoCall1.Parent.AssertCalled(t, "Update", mock.Anything, mock.Anything)
assert.True(t, ok, fmt.Sprintf("Update was not called on %s", tc.desc))
}
Expand Down
1 change: 0 additions & 1 deletion pkg/sdk/go/things_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var (
adminID = generateUUID(&testing.T{})
users = map[string]string{adminToken: adminID}
ID = testsutil.GenerateUUID(&testing.T{}, idProvider)
tadminPolicy = mocks.MockSubjectSet{Object: ID, Relation: clients.AdminRelationKey}
uadminPolicy = cmocks.SubjectSet{Subject: ID, Relation: clients.AdminRelationKey}
)

Expand Down

0 comments on commit 6ab40f5

Please sign in to comment.