mirror of
https://github.com/wneessen/apg-go.git
synced 2024-11-14 01:42:55 +01:00
Winni Neessen
79f921f9ad
This commit introduces the .gitignore configuration file and adds SPDX headers to several files including test and documentation files. The headers provide license information in a standardized format which can be easily picked up by automated tools for license compliance checks. Additionally, it deleted a .idea/.gitignore file, which is a project specific IDE configuration file not necessary for the repository. It also introduced a README.md file providing more insightful information about the project.
31 lines
628 B
Go
31 lines
628 B
Go
// SPDX-FileCopyrightText: 2021-2024 Winni Neessen <wn@neessen.dev>
|
|
//
|
|
// SPDX-License-Identifier: MIT
|
|
|
|
package apg
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestHasBeenPwned(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
password string
|
|
want bool
|
|
}{
|
|
{"Pwned PW", "Test123", true},
|
|
{"Secure PW", "Cta8mWYmW7O*j1V!YMTS", false},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.name, func(t *testing.T) {
|
|
got, err := HasBeenPwned(tt.password)
|
|
if err != nil {
|
|
t.Errorf("HasBeenPwned() failed: %s", err)
|
|
}
|
|
if tt.want != got {
|
|
t.Errorf("HasBeenPwned() failed, wanted: %t, got: %t", tt.want, got)
|
|
}
|
|
})
|
|
}
|
|
}
|