Core components of the web application. https://write.as
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
323 B

  1. package auth
  2. import "testing"
  3. const pass = "password"
  4. var hash []byte
  5. func TestHash(t *testing.T) {
  6. var err error
  7. hash, err = HashPass([]byte(pass))
  8. if err != nil {
  9. t.Error("Password hash failed.")
  10. }
  11. }
  12. func TestAuth(t *testing.T) {
  13. if !Authenticated(hash, []byte(pass)) {
  14. t.Error("Didn't authenticate.")
  15. }
  16. }