| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package certconfig | 5 package certconfig |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "testing" | 8 "testing" |
| 9 | 9 |
| 10 "golang.org/x/net/context" | 10 "golang.org/x/net/context" |
| 11 | 11 |
| 12 ds "github.com/luci/gae/service/datastore" | 12 ds "github.com/luci/gae/service/datastore" |
| 13 "github.com/luci/gae/service/info" | 13 "github.com/luci/gae/service/info" |
| 14 "github.com/luci/luci-go/appengine/gaetesting" | 14 "github.com/luci/luci-go/appengine/gaetesting" |
| 15 "github.com/luci/luci-go/common/config" | |
| 16 "github.com/luci/luci-go/common/config/impl/memory" | 15 "github.com/luci/luci-go/common/config/impl/memory" |
| 16 "github.com/luci/luci-go/luci_config/server/cfgclient/backend/testconfig
" |
| 17 | 17 |
| 18 "github.com/luci/luci-go/tokenserver/api/admin/v1" | 18 "github.com/luci/luci-go/tokenserver/api/admin/v1" |
| 19 | 19 |
| 20 . "github.com/luci/luci-go/common/testing/assertions" | 20 . "github.com/luci/luci-go/common/testing/assertions" |
| 21 . "github.com/smartystreets/goconvey/convey" | 21 . "github.com/smartystreets/goconvey/convey" |
| 22 ) | 22 ) |
| 23 | 23 |
| 24 func TestImportCAConfigsRPC(t *testing.T) { | 24 func TestImportCAConfigsRPC(t *testing.T) { |
| 25 Convey("with mock context", t, func() { | 25 Convey("with mock context", t, func() { |
| 26 ctx := gaetesting.TestingContext() | 26 ctx := gaetesting.TestingContext() |
| (...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 244 CEKCFVRB/c+RPwfgW2k9fCIKUZYZD+uzok3I6U0ycEiazKtWLmrOd3J+ltqY1hTK | 244 CEKCFVRB/c+RPwfgW2k9fCIKUZYZD+uzok3I6U0ycEiazKtWLmrOd3J+ltqY1hTK |
| 245 ZRn8T2pCm4i+oVE0ObPNRhcHMDWIGDuFpVKk4Hi/8h00EcvoJRRKSj5yIReVURLX | 245 ZRn8T2pCm4i+oVE0ObPNRhcHMDWIGDuFpVKk4Hi/8h00EcvoJRRKSj5yIReVURLX |
| 246 FNhRTP7aoGf7ktzOH2frOtyKxFO49BXgq43dmLNIzLA/kSWnhSvzxVzSEtZALV4q | 246 FNhRTP7aoGf7ktzOH2frOtyKxFO49BXgq43dmLNIzLA/kSWnhSvzxVzSEtZALV4q |
| 247 OU7SevV9eJ7oeWhDdMmlVwWgH4upTqEseAcs28JpN9UaSDLsnQloX4s1VIJ0Pbi7 | 247 OU7SevV9eJ7oeWhDdMmlVwWgH4upTqEseAcs28JpN9UaSDLsnQloX4s1VIJ0Pbi7 |
| 248 OA//8e4Tx7mXU21Pr/3Ek3QB4vwWeo9n9wPd8vz/Y5YjV1e1Qw+Ey7jk3thBoAyu | 248 OA//8e4Tx7mXU21Pr/3Ek3QB4vwWeo9n9wPd8vz/Y5YjV1e1Qw+Ey7jk3thBoAyu |
| 249 JzP7+U1dTrpLTi0souhc4f2OSJ9v3QRFFBHB2Yfbze+swmF9VPcMcazaelXnV1zH | 249 JzP7+U1dTrpLTi0souhc4f2OSJ9v3QRFFBHB2Yfbze+swmF9VPcMcazaelXnV1zH |
| 250 PkoYH9WC8tSbqNof3g== | 250 PkoYH9WC8tSbqNof3g== |
| 251 -----END CERTIFICATE----- | 251 -----END CERTIFICATE----- |
| 252 ` | 252 ` |
| 253 | 253 |
| 254 // prepareCfg injects config.Interface implementation with a bunch of | 254 // prepareCfg injects config.Backend implementation with a bunch of |
| 255 // config files. | 255 // config files. |
| 256 func prepareCfg(c context.Context, configFile string) context.Context { | 256 func prepareCfg(c context.Context, configFile string) context.Context { |
| 257 » return config.SetImplementation(c, memory.New(map[string]memory.ConfigSe
t{ | 257 » return testconfig.WithCommonClient(c, memory.New(map[string]memory.Confi
gSet{ |
| 258 "services/" + info.AppID(c): { | 258 "services/" + info.AppID(c): { |
| 259 "tokenserver.cfg": configFile, | 259 "tokenserver.cfg": configFile, |
| 260 "certs/fake.ca.crt": fakeCACrt, | 260 "certs/fake.ca.crt": fakeCACrt, |
| 261 "certs/another-fake.ca.crt": anotherFakeCACrt, | 261 "certs/another-fake.ca.crt": anotherFakeCACrt, |
| 262 }, | 262 }, |
| 263 })) | 263 })) |
| 264 } | 264 } |
| OLD | NEW |