(t *testing.T)
| 71 | } |
| 72 | |
| 73 | func TestNewBasicAuth(t *testing.T) { |
| 74 | |
| 75 | t.Run("should create a basic auth scheme from the supplied config", func(t *testing.T) { |
| 76 | filename, err := createBasicAuthFile("foo:bar", t) |
| 77 | |
| 78 | if err != nil { |
| 79 | t.Error(err) |
| 80 | } |
| 81 | |
| 82 | _, err = newBasicAuth(config.BasicAuth{ |
| 83 | File: filename, |
| 84 | }) |
| 85 | |
| 86 | if err != nil { |
| 87 | t.Error(err) |
| 88 | } |
| 89 | }) |
| 90 | |
| 91 | t.Run("should log a warning when credentials are malformed", func(t *testing.T) { |
| 92 | filename, err := createBasicAuthFile("foosdlijdgohdgdbar", t) |
| 93 | |
| 94 | if err != nil { |
| 95 | t.Error(err) |
| 96 | } |
| 97 | |
| 98 | _, err = newBasicAuth(config.BasicAuth{ |
| 99 | File: filename, |
| 100 | }) |
| 101 | |
| 102 | if err != nil { |
| 103 | t.Error(err) |
| 104 | } |
| 105 | }) |
| 106 | } |
| 107 | |
| 108 | func TestBasic_Authorised(t *testing.T) { |
| 109 | basicAuth, err := createBasicAuth("foo", "bar", t) |
nothing calls this directly
no test coverage detected