MCPcopy
hub / github.com/openpubkey/opkssh / TestProvidersFileLoader_ToTable

Function TestProvidersFileLoader_ToTable

policy/providerloader_test.go:165–195  ·  view source on GitHub ↗

Test ProvidersFileLoader.ToTable.

(t *testing.T)

Source from the content-addressed store, hash-verified

163
164// Test ProvidersFileLoader.ToTable.
165func 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}

Callers

nothing calls this directly

Calls 3

AddRowMethod · 0.95
ToTableMethod · 0.95
GetRowsMethod · 0.45

Tested by

no test coverage detected