mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-22 13:50:49 +01:00
Merge pull request #55 from wneessen/more_testcoverage
Add test for excluded characters in config
This commit is contained in:
commit
da910fde14
1 changed files with 17 additions and 0 deletions
|
@ -220,6 +220,23 @@ func TestGetCharRangeFromConfig(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestGetCharRangeFromConfig_ExcludeChar(t *testing.T) {
|
||||
defaultConf := NewConfig()
|
||||
defaultGen := New(defaultConf)
|
||||
defaultRange := defaultGen.GetCharRangeFromConfig()
|
||||
defaultRange = strings.ReplaceAll(defaultRange, "a", "")
|
||||
defaultRange = strings.ReplaceAll(defaultRange, "b", "")
|
||||
|
||||
config := NewConfig(WithExcludeChars("ab"))
|
||||
generator := New(config)
|
||||
excludeRange := generator.GetCharRangeFromConfig()
|
||||
|
||||
if excludeRange != defaultRange {
|
||||
t.Errorf("GetCharRangeFromConfig(WithExcludeChars()) failed. Expected"+
|
||||
"char range: %s, got: %s", defaultRange, excludeRange)
|
||||
}
|
||||
}
|
||||
|
||||
func TestGetPasswordLength(t *testing.T) {
|
||||
config := NewConfig()
|
||||
generator := New(config)
|
||||
|
|
Loading…
Reference in a new issue