(t *testing.T)
| 142 | } |
| 143 | |
| 144 | func TestFileStoreGetAll(t *testing.T) { |
| 145 | s1 := "https://example.com" |
| 146 | s2 := "https://example2.example.com" |
| 147 | f := &fakeStore{configs: map[string]types.AuthConfig{ |
| 148 | s1: { |
| 149 | Username: "foo@example.com", |
| 150 | Auth: "super_secret_token", |
| 151 | ServerAddress: "https://example.com", |
| 152 | }, |
| 153 | s2: { |
| 154 | Username: "foo@example2.com", |
| 155 | Auth: "super_secret_token2", |
| 156 | ServerAddress: "https://example2.example.com", |
| 157 | }, |
| 158 | }} |
| 159 | |
| 160 | s := NewFileStore(f) |
| 161 | as, err := s.GetAll() |
| 162 | if err != nil { |
| 163 | t.Fatal(err) |
| 164 | } |
| 165 | if len(as) != 2 { |
| 166 | t.Fatalf("wanted 2, got %d", len(as)) |
| 167 | } |
| 168 | if as[s1].Auth != "super_secret_token" { |
| 169 | t.Fatalf("expected auth `super_secret_token`, got %s", as[s1].Auth) |
| 170 | } |
| 171 | if as[s1].Username != "foo@example.com" { |
| 172 | t.Fatalf("expected username `foo@example.com`, got %s", as[s1].Username) |
| 173 | } |
| 174 | if as[s2].Auth != "super_secret_token2" { |
| 175 | t.Fatalf("expected auth `super_secret_token2`, got %s", as[s2].Auth) |
| 176 | } |
| 177 | if as[s2].Username != "foo@example2.com" { |
| 178 | t.Fatalf("expected username `foo@example2.com`, got %s", as[s2].Username) |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | func TestFileStoreErase(t *testing.T) { |
| 183 | f := &fakeStore{configs: map[string]types.AuthConfig{ |
nothing calls this directly
no test coverage detected
searching dependent graphs…