コード例 #1
0
ファイル: config_test.go プロジェクト: jkary/core
func (*configSuite) TestStoreConfigTLS(c *gc.C) {
	var config localTLSStorageConfig
	m, err := localstorage.StoreConfig(&config)
	c.Assert(err, gc.IsNil)
	c.Assert(m, gc.DeepEquals, map[string]string{
		localstorage.StorageDir:  "",
		localstorage.StorageAddr: "",
	})

	config.storageDir = "a"
	config.storageAddr = "b"
	config.caCertPEM = "heyhey"
	config.caKeyPEM = "hoho"
	config.hostnames = []string{"easy", "as", "1.2.3"}
	config.authkey = "password"
	m, err = localstorage.StoreConfig(&config)
	c.Assert(err, gc.IsNil)
	c.Assert(m, gc.DeepEquals, map[string]string{
		localstorage.StorageDir:       config.storageDir,
		localstorage.StorageAddr:      config.storageAddr,
		localstorage.StorageCACert:    string(config.caCertPEM),
		localstorage.StorageCAKey:     string(config.caKeyPEM),
		localstorage.StorageHostnames: mustMarshalYAML(c, config.hostnames),
		localstorage.StorageAuthKey:   config.authkey,
	})
}
コード例 #2
0
ファイル: config_test.go プロジェクト: jkary/core
func (*configSuite) TestStoreConfig(c *gc.C) {
	var config localStorageConfig
	m, err := localstorage.StoreConfig(&config)
	c.Assert(err, gc.IsNil)
	c.Assert(m, gc.DeepEquals, map[string]string{
		localstorage.StorageDir:  "",
		localstorage.StorageAddr: "",
	})

	config.storageDir = "a"
	config.storageAddr = "b"
	m, err = localstorage.StoreConfig(&config)
	c.Assert(err, gc.IsNil)
	c.Assert(m, gc.DeepEquals, map[string]string{
		localstorage.StorageDir:  config.storageDir,
		localstorage.StorageAddr: config.storageAddr,
	})
}