Test ProvidersFileLoader.ToTable.
(t *testing.T)
| 163 | |
| 164 | // Test ProvidersFileLoader.ToTable. |
| 165 | func TestProvidersFileLoader_ToTable(t *testing.T) { |
| 166 | policy := ProviderPolicy{} |
| 167 | policy.AddRow(ProvidersRow{ |
| 168 | Issuer: "issuer1", |
| 169 | ClientID: "client1", |
| 170 | ExpirationPolicy: "12h", |
| 171 | }) |
| 172 | policy.AddRow(ProvidersRow{ |
| 173 | Issuer: "issuer2", |
| 174 | ClientID: "client2", |
| 175 | ExpirationPolicy: "24h", |
| 176 | }) |
| 177 | policy.AddRow(ProvidersRow{ |
| 178 | Issuer: "issuer3", |
| 179 | ClientID: "client3", |
| 180 | ExpirationPolicy: "48h", |
| 181 | }) |
| 182 | loader := ProvidersFileLoader{} |
| 183 | table := loader.ToTable(policy) |
| 184 | rows := table.GetRows() |
| 185 | require.Equal(t, 3, len(rows)) |
| 186 | if rows[0][0] != "issuer1" || rows[0][1] != "client1" || rows[0][2] != "12h" { |
| 187 | t.Error("first row in table does not match expected values") |
| 188 | } |
| 189 | if rows[1][0] != "issuer2" || rows[1][1] != "client2" || rows[1][2] != "24h" { |
| 190 | t.Error("second row in table does not match expected values") |
| 191 | } |
| 192 | if rows[2][0] != "issuer3" || rows[2][1] != "client3" || rows[2][2] != "48h" { |
| 193 | t.Error("third row in table does not match expected values") |
| 194 | } |
| 195 | } |