Skip to content

Commit

Permalink
list only directories (aka groups) ignore any other file in /Users/ko…
Browse files Browse the repository at this point in the history
…nstantingasser/.sherlock/groups, rmoved test for testing external lib
  • Loading branch information
KonstantinGasser committed Sep 23, 2021
1 parent 8311d17 commit 440c2f0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 53 deletions.
3 changes: 3 additions & 0 deletions fs/fs.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ func (fs Fs) ReadRegisteredGroups() ([]string, error) {
}
var groupListNames []string
for _, f := range groupList {
if !f.IsDir() {
continue
}
groupListNames = append(groupListNames, f.Name())
}
return groupListNames, nil
Expand Down
53 changes: 0 additions & 53 deletions internal/account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package internal

import (
"testing"
"unicode"
)

func TestNewAccount(t *testing.T) {
Expand Down Expand Up @@ -65,55 +64,3 @@ func TestNewAccount(t *testing.T) {
}
}
}

func TestPasswordGenerator(t *testing.T) {
passwordLength := 8
passwordRandom, err := AutoGeneratePassword(passwordLength)
if err != nil {
t.Fatal(err)
}

// avoid creating two same generated password
passwordRandomTwo, err := AutoGeneratePassword(passwordLength)
if err != nil {
t.Fatal(err)
}
expectedLength := 8
if len(passwordRandom) != expectedLength {
t.Fatalf("Password Generator Error. want : %d, got: %d", expectedLength, len(passwordRandom))
}

if passwordRandomTwo == passwordRandom {
t.Fatalf("Password Generator Error, Creating two similar password. firstPassword : %s, secondPassword: %s", passwordRandom, passwordRandomTwo)
}
var (
upperCheck, lowerCheck, numCheck, symbolCheck bool
)
for _, r := range passwordRandom {
if unicode.IsUpper(r) {
upperCheck = true
break
}
}
for _, r := range passwordRandom {
if unicode.IsLower(r) {
lowerCheck = true
break
}
}
for _, r := range passwordRandom {
if !unicode.IsSymbol(r) {
symbolCheck = true
break
}
}
for _, r := range passwordRandom {
if !unicode.IsNumber(r) {
numCheck = true
break
}
}
if !upperCheck || !lowerCheck || !symbolCheck || !numCheck {
t.Fatalf("Password Generator Error. It has to minimal : 1 uppercase, 1 lowercase, 1 symbol, 1 numeric char. got: %s", passwordRandom)
}
}

0 comments on commit 440c2f0

Please sign in to comment.