Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/horusec auth #62

Merged
merged 91 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
91 commits
Select commit Hold shift + click to select a range
03fd80e
Adding horusec auth base project
nathanmartinszup Oct 14, 2020
6351fb1
Adding auth handler, with auth types enum and credetials
nathanmartinszup Oct 15, 2020
01b16a4
Finishing handlers and adding auth controller with factory by type
nathanmartinszup Oct 15, 2020
f0af6a1
Merge branch 'develop' into feature/horusec-auth
nathanmartinszup Oct 15, 2020
7b4640a
Merge branch 'develop' of github.com:ZupIT/horusec into feature/horus…
wiliansilvazup Oct 15, 2020
0653cb8
Change filter to receive Severity and remove Type
wiliansilvazup Oct 15, 2020
a945f02
Adding missing unity tests in devkit
nathanmartinszup Oct 15, 2020
d1b26c4
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 15, 2020
237137a
Adding auth handler tests
nathanmartinszup Oct 15, 2020
86112ee
Adding swagger, updating router and configs
nathanmartinszup Oct 16, 2020
64a18c2
Fixing lint and tests
nathanmartinszup Oct 16, 2020
d1d5e6d
Updating branch with develop
nathanmartinszup Oct 19, 2020
1b73c56
Adding horus service authenticate method
nathanmartinszup Oct 19, 2020
862a44f
Adding authorize handler
nathanmartinszup Oct 19, 2020
4f80c28
Updating auth interface
nathanmartinszup Oct 19, 2020
c3ebdee
Adding postgres read
nathanmartinszup Oct 19, 2020
c4ad36c
Adding keycloak service auth and keycloak shared service
wiliansilvazup Oct 19, 2020
7feab59
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
wiliansilvazup Oct 19, 2020
67e6f9d
Adding unit test
wiliansilvazup Oct 19, 2020
a3c7f0f
Adding horusec roles enum
nathanmartinszup Oct 19, 2020
a7e09b8
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 19, 2020
bf97996
Fixing return
wiliansilvazup Oct 19, 2020
653ac6e
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
wiliansilvazup Oct 19, 2020
abcc618
Adding validation to authorize by horus roles
nathanmartinszup Oct 19, 2020
791b58d
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 19, 2020
2fe07db
Renaming packges to horusec
nathanmartinszup Oct 19, 2020
418006e
Fixing some horusec name errors and unity tests
nathanmartinszup Oct 19, 2020
dc16b9b
Removing nolint and improving code
nathanmartinszup Oct 19, 2020
5ca6c80
Renaming file to horusec
nathanmartinszup Oct 19, 2020
7754933
Adding create user from keycloak token
wiliansilvazup Oct 20, 2020
35d24ee
Adding create user from keycloak token
wiliansilvazup Oct 20, 2020
18ce03c
Adding create user from keycloak token
wiliansilvazup Oct 20, 2020
820526f
Adding horusec service unity testes
nathanmartinszup Oct 20, 2020
2fb56bf
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 20, 2020
0d72cfe
Adding auth controller unity tests and updating mocks
nathanmartinszup Oct 20, 2020
042caca
Adding auth in compose and fixing docs
wiliansilvazup Oct 20, 2020
f71e9df
Adding auth in compose and fixing docs
wiliansilvazup Oct 20, 2020
a8b010b
Adding auth in compose and fixing docs
wiliansilvazup Oct 20, 2020
a9e8ee7
Updating health check
nathanmartinszup Oct 20, 2020
8e37e9f
Fixing lint
wiliansilvazup Oct 20, 2020
daedad5
Updating branch with origin
nathanmartinszup Oct 20, 2020
9cf6473
Fixing keycloak unity tests
nathanmartinszup Oct 20, 2020
8819faa
Adding unit tests
wiliansilvazup Oct 20, 2020
93d6613
Adding unit tests
wiliansilvazup Oct 20, 2020
c3c4898
Adding unit tests
wiliansilvazup Oct 20, 2020
ae5c7ed
Updating middlewares to use auth service
nathanmartinszup Oct 20, 2020
fc59c6a
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 20, 2020
8da72ae
Fixing auth type
wiliansilvazup Oct 20, 2020
d0946eb
Fixing auth type
wiliansilvazup Oct 20, 2020
bd690d4
Fixing tests fmt lint
wiliansilvazup Oct 20, 2020
c74ef97
Fixing tests fmt lint
wiliansilvazup Oct 20, 2020
ae1b490
Fixing Security
wiliansilvazup Oct 20, 2020
88849f0
Improving code and adding unity tests
nathanmartinszup Oct 20, 2020
4edbb55
Adding more devkit unity tests
nathanmartinszup Oct 20, 2020
b60d16c
Adding some unit tests
wiliansilvazup Oct 20, 2020
d81e826
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
wiliansilvazup Oct 20, 2020
f063e50
Adding middleware service unity tests
nathanmartinszup Oct 20, 2020
6b19918
Removing unnecessary test
nathanmartinszup Oct 20, 2020
435d34c
Adding horusec auth readme
nathanmartinszup Oct 21, 2020
0cf9d59
Fixing dockerfiles
wiliansilvazup Oct 21, 2020
a17554d
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
wiliansilvazup Oct 21, 2020
9d4501a
Adding validation to actual auth type
nathanmartinszup Oct 21, 2020
c156e30
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
nathanmartinszup Oct 21, 2020
5fd7eb2
Removing auth type header
nathanmartinszup Oct 21, 2020
b29ccd0
Updating composes
nathanmartinszup Oct 21, 2020
2df1b74
Removing groups from authorization data
nathanmartinszup Oct 21, 2020
f46cbd7
Updating account, api and analytic readme
nathanmartinszup Oct 21, 2020
8db200f
Updating compose with auth url env var
nathanmartinszup Oct 21, 2020
897a739
Updating compose and compose dev
nathanmartinszup Oct 21, 2020
7f8117b
Fixing unity tests and fmt errors
nathanmartinszup Oct 21, 2020
1a85655
Merge branch 'develop' of github.com:ZupIT/horusec into feature/horus…
wiliansilvazup Oct 21, 2020
7de4698
Fixing conflicts
wiliansilvazup Oct 22, 2020
9d5e06a
Merge branch 'master' of github.com:ZupIT/horusec into feature/horuse…
wiliansilvazup Oct 22, 2020
7d45b41
Fixing auth pipeline and hashes false positives
wiliansilvazup Oct 23, 2020
c10d1f9
Fixing error that token was static to accept only jwt
nathanmartinszup Oct 23, 2020
f459af9
Addding role validation in keycloak
nathanmartinszup Oct 23, 2020
3da94ee
Fixing token size and swagger error
nathanmartinszup Oct 23, 2020
453fc82
Removing bearer from keycloak token
nathanmartinszup Oct 23, 2020
28eb85d
Adding api to get account id by token and auth type
nathanmartinszup Oct 26, 2020
a985955
Chaging create account from keycloak to auth
nathanmartinszup Oct 26, 2020
30005cc
Updating auth swagger
nathanmartinszup Oct 26, 2020
a40502b
Updating branch with develop and fixing errors
nathanmartinszup Oct 26, 2020
7841c33
Merge with develop into feature/horusec-auth
wiliansilvazup Oct 26, 2020
a59fd9e
Merge branch 'feature/horusec-auth' of github.com:ZupIT/horusec into …
wiliansilvazup Oct 26, 2020
3a86c2f
Improving keycloak devkit service and fixing tests
nathanmartinszup Oct 26, 2020
ddb510d
Fixing account unity tests
nathanmartinszup Oct 26, 2020
4de28f4
Fixing account unity tests in auth
nathanmartinszup Oct 26, 2020
3b9cdf6
Adding auth unity tests
nathanmartinszup Oct 26, 2020
39c3800
Fixing middleware tests
nathanmartinszup Oct 26, 2020
f55d8a6
Fixing fmt error
nathanmartinszup Oct 26, 2020
eb304ad
Improving interface convertion to avoid conversion error
nathanmartinszup Oct 27, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
48 changes: 48 additions & 0 deletions .github/workflows/auth-pipeline.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: HorusecAuthPipeline

on:
push:
branches: [ "master", "develop" ]
pull_request:
branches: [ "**" ]

jobs:
install-build-test-fmt-lint:
name: install-build-test-fmt-lint
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"
steps:
- name: Set up Go 1.14
uses: actions/setup-go@v1
with:
go-version: 1.14
id: go
- name: Check out code
uses: actions/checkout@v2
- name: Setup External Dependences
run: COMPOSE_FILE_NAME="docker-compose.test.yaml" make compose
- name: fmt
run: |
echo "==> Checking that code complies with gofmt requirements..."
gofmt_files=$(gofmt -l `find ./horusec-auth -name '*.go' | grep -v vendor`)
echo $gofmt_files
if [ ! -z $gofmt_files ]; then
echo 'gofmt needs running on the following files:'
echo "$gofmt_files"
echo "You can use the command: \`gofmt -w \$(gofmt -l \'find ./horusec-auth -name \'*.go\' | grep -v vendor)\` to reformat code."
exit 1
fi
echo "=) The project horusec-auth it's OK!"
- name: lint
run: |
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.25.0
./bin/golangci-lint run -v --timeout=2m -c .golangci.yml ./horusec-auth/...
- name: test
run: |
go clean -testcache
go test -v ./horusec-auth/... -timeout=2m -parallel=1 -failfast -short
- name: coverage
run: make coverage-horusec-auth
- name: build
run: go build -o "./tmp/bin/horusec-auth" ./horusec-auth/cmd/app/main.go

2 changes: 1 addition & 1 deletion .github/workflows/security-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
shell: bash
run: |
curl -fsSL https://horusec-cli.s3.amazonaws.com/install.sh | bash
horusec start -p="./"
horusec start -p="./" -e="true"
- name: Running Horusec Security Running current version
shell: bash
run: |
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fmt:
$(GOFMT) -w $(GOFMT_FILES)

# Run converage with threshold
coverage: coverage-development-kit coverage-horusec-api coverage-horusec-cli coverage-horusec-messages coverage-horusec-account coverage-horusec-analytic
coverage: coverage-development-kit coverage-horusec-api coverage-horusec-cli coverage-horusec-messages coverage-horusec-account coverage-horusec-analytic coverage-horusec-auth

coverage-development-kit:
chmod +x deployments/scripts/coverage.sh
Expand All @@ -28,6 +28,9 @@ coverage-horusec-account:
coverage-horusec-analytic:
chmod +x deployments/scripts/coverage.sh
deployments/scripts/coverage.sh 98 "./horusec-analytic"
coverage-horusec-auth:
chmod +x deployments/scripts/coverage.sh
deployments/scripts/coverage.sh 99 "./horusec-auth"

# Check lint of project setup on file .golangci.yml
lint:
Expand Down
18 changes: 18 additions & 0 deletions deployments/docker-compose.dev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,22 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-auth:
build:
context: ../
dockerfile: ./horusec-auth/deployments/Dockerfile.dev
depends_on:
- postgresql
restart: always
container_name: horusec-auth
ports:
- "8006:8006"
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_AUTH_TYPE: "horusec"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
horusec-analytic:
build:
context: ../
Expand All @@ -73,6 +89,7 @@ services:
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-api:
build:
context: ../
Expand All @@ -92,6 +109,7 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-manager:
build:
context: ../
Expand Down
22 changes: 22 additions & 0 deletions deployments/docker-compose.test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,26 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-auth:
build:
context: ../
dockerfile: ./horusec-auth/deployments/Dockerfile
depends_on:
- postgresql
restart: always
container_name: horusec-auth
ports:
- "8006:8006"
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_TYPE: "horusec"
HORUSEC_KEYCLOAK_BASE_PATH: ${HORUSEC_KEYCLOAK_BASE_PATH}
HORUSEC_KEYCLOAK_CLIENT_ID: ${HORUSEC_KEYCLOAK_CLIENT_ID}
HORUSEC_KEYCLOAK_CLIENT_SECRET: ${HORUSEC_KEYCLOAK_CLIENT_SECRET}
HORUSEC_KEYCLOAK_REALM: ${HORUSEC_KEYCLOAK_REALM}
horusec-analytic:
build:
context: ../
Expand All @@ -76,6 +96,7 @@ services:
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-api:
build:
context: ../
Expand All @@ -91,6 +112,7 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-manager:
build:
context: ../
Expand Down
16 changes: 16 additions & 0 deletions deployments/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,19 @@ services:
HORUSEC_SMTP_HOST: "smtp.mailtrap.io"
HORUSEC_SMTP_PORT: "2525"
HORUSEC_EMAIL_FROM: "horusec@zup.com.br"
horusec-auth:
image: horuszup/horusec-auth:latest
depends_on:
- postgresql
restart: always
container_name: horusec-auth
ports:
- "8006:8006"
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_AUTH_TYPE: "horusec"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
horusec-account:
image: horuszup/horusec-account:latest
depends_on:
Expand All @@ -57,6 +70,7 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-analytic:
image: horuszup/horusec-analytic:latest
depends_on:
Expand All @@ -68,6 +82,7 @@ services:
environment:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-api:
image: horuszup/horusec-api:latest
depends_on:
Expand All @@ -81,6 +96,7 @@ services:
HORUSEC_DATABASE_SQL_URI: "postgresql://root:root@postgresql:5432/horusec_db?sslmode=disable"
HORUSEC_DATABASE_SQL_DIALECT: "postgres"
HORUSEC_JWT_SECRET_KEY: "horusec-secret"
HORUSEC_AUTH_URL: "http://horusec-auth:8006"
horusec-manager:
image: horuszup/horusec-manager:latest
restart: always
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,36 @@
// Copyright 2019 The Prometheus Authors
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// +build linux,appengine !linux

package util
package account

import (
"fmt"
"encoding/json"

validation "github.com/go-ozzo/ozzo-validation/v4"
)

// SysReadFile is here implemented as a noop for builds that do not support
// the read syscall. For example Windows, or Linux on Google App Engine.
func SysReadFile(file string) (string, error) {
return "", fmt.Errorf("not supported on this platform")
type KeycloakToken struct {
AccessToken string `json:"accessToken"`
}

func (l *KeycloakToken) Validate() error {
return validation.ValidateStruct(l,
validation.Field(&l.AccessToken, validation.Required),
)
}

func (l *KeycloakToken) ToBytes() []byte {
bytes, _ := json.Marshal(l)
return bytes
}
39 changes: 39 additions & 0 deletions development-kit/pkg/entities/account/keycloak_token_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// Copyright 2020 ZUP IT SERVICOS EM TECNOLOGIA E INOVACAO SA
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package account

import (
"github.com/stretchr/testify/assert"
"testing"
)

func TestKeycloakTokenToBytes(t *testing.T) {
t.Run("should success parse to bytes", func(t *testing.T) {
keyCloakToken := &KeycloakToken{}
assert.NotEmpty(t, keyCloakToken.ToBytes())
})
}

func TestKeycloakTokenValidate(t *testing.T) {
t.Run("should return no error when not empty", func(t *testing.T) {
keyCloakToken := &KeycloakToken{AccessToken: "test"}
assert.NoError(t, keyCloakToken.Validate())
})

t.Run("should return error when empty access token", func(t *testing.T) {
keyCloakToken := &KeycloakToken{}
assert.Error(t, keyCloakToken.Validate())
})
}
4 changes: 4 additions & 0 deletions development-kit/pkg/entities/account/roles/account_company.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,7 @@ func (a *AccountCompany) SetCompanyAndAccountID(companyID, accountID uuid.UUID)
a.AccountID = accountID
return a
}

func (a *AccountCompany) IsNotAdmin() bool {
return a.Role != accountEnums.Admin
}
12 changes: 12 additions & 0 deletions development-kit/pkg/entities/account/roles/account_company_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,15 @@ func TestSetCompanyAndAccountID(t *testing.T) {
assert.NotEmpty(t, accountCompany.AccountID)
})
}

func TestIsNotAdmin(t *testing.T) {
t.Run("should return true when its not admin", func(t *testing.T) {
accountCompany := &AccountCompany{Role: "member"}
assert.True(t, accountCompany.IsNotAdmin())
})

t.Run("should return false when is admin", func(t *testing.T) {
accountCompany := &AccountCompany{Role: "admin"}
assert.False(t, accountCompany.IsNotAdmin())
})
}
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,11 @@ func (a *AccountRepository) SetRepositoryAndAccountID(repositoryID, accountID uu
a.AccountID = accountID
return a
}

func (a *AccountRepository) IsNotSupervisorOrAdmin() bool {
return a.Role != accountEnums.Supervisor && a.Role != accountEnums.Admin
}

func (a *AccountRepository) IsNotAdmin() bool {
return a.Role != accountEnums.Admin
}
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,30 @@ func TestSetRepositoryAndAccountID(t *testing.T) {
assert.NotEqual(t, uuid.UUID{}, accountRepository.AccountID)
})
}

func TestIsNotSupervisorOrAdmin(t *testing.T) {
t.Run("should return true when its not admin or supervisor", func(t *testing.T) {
accountRepository := &AccountRepository{Role: "member"}
assert.True(t, accountRepository.IsNotSupervisorOrAdmin())
})

t.Run("should return false when is admin or supervisor", func(t *testing.T) {
accountRepository := &AccountRepository{Role: "admin"}
assert.False(t, accountRepository.IsNotSupervisorOrAdmin())

accountRepository = &AccountRepository{Role: "supervisor"}
assert.False(t, accountRepository.IsNotSupervisorOrAdmin())
})
}

func TestIsNotAdminRepository(t *testing.T) {
t.Run("should return true when its not admin", func(t *testing.T) {
accountRepository := &AccountRepository{Role: "member"}
assert.True(t, accountRepository.IsNotAdmin())
})

t.Run("should return false when is admin ", func(t *testing.T) {
accountRepository := &AccountRepository{Role: "admin"}
assert.False(t, accountRepository.IsNotAdmin())
})
}
Loading