Contains the Concourse pipeline definition for building a line-server container
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.

24 lines
564 B

  1. package main
  2. import (
  3. "testing"
  4. )
  5. func TestCheckAuth(t *testing.T) {
  6. authKeys := []string{
  7. "vhvZ/PT1jeTbTAJ8JdoxddqFtebSxdVb0vwPlYO+4HM=",
  8. "vFpNprT9wbHgwAubpvRxYCCpA2FQMAK6hFqPvAGrdZo=",
  9. }
  10. if r, err := checkAuth(authKeys, ""); err != nil && r {
  11. t.Fatal("Authorization passed for empty key")
  12. }
  13. if r, err := checkAuth(authKeys, "thisisnotvalid"); err != nil && r {
  14. t.Fatal("Authorization passed for invalid key")
  15. }
  16. if r, err := checkAuth(authKeys, "haPVipRnGJ0QovA9nyqK"); err != nil && !r {
  17. t.Fatal("Authorization failed for valid key")
  18. }
  19. }