mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 08:46:48 +00:00
Idea from Matthew Holt, using the haveibeenpwned API to query whether a password has been found in a data-breach. Signed-off-by: Alex Ellis (VMware) <alexellis2@gmail.com>
23 lines
381 B
Go
23 lines
381 B
Go
package function
|
|
|
|
import (
|
|
"encoding/json"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Handle(t *testing.T) {
|
|
res := Handle([]byte("test1234"))
|
|
|
|
result := result{}
|
|
err := json.Unmarshal([]byte(res), &result)
|
|
if err != nil {
|
|
t.Errorf("unable to unmarshal response, error: %s", err)
|
|
t.Fail()
|
|
}
|
|
|
|
if result.Found == 0 {
|
|
t.Errorf("expected test1234 to be found several times")
|
|
t.Fail()
|
|
}
|
|
}
|