예제 #1
0
func (s *ConfigSuite) TestZeroAccounts(c *T.C) {
	cfg := NewConfig(s.dataDir)
	cfg.Setup()
	f, err := os.Create(filepath.Join(s.dataDir, configName))
	if err != nil {
		c.Error(err)
	}
	f.WriteString(testNoAccountsFile)
	err = cfg.Load()
	c.Assert(err, T.NotNil)
}
예제 #2
0
func (s *ConfigSuite) TestGoodConfigLoad(c *T.C) {
	cfg := NewConfig(s.dataDir)
	cfg.Setup()
	f, err := os.Create(filepath.Join(s.dataDir, configName))
	if err != nil {
		c.Error(err)
	}
	f.WriteString(testGoodFile)
	cfg.Load()
	c.Assert("iy1Cbc7CjshE2VqYQ0OfWGxt", T.Equals, cfg.FirstAccount().ClientSecret)
	// Let's just say json unmarshalling works
}
예제 #3
0
func (s *ConfigSuite) TestConfigSetup(c *T.C) {
	cfg := NewConfig(s.dataDir)
	cfg.Setup()
	c.Assert(filepath.Join(s.dataDir, blobName), fileExists)
}
예제 #4
0
func (s *ConfigSuite) TestNewConfig(c *T.C) {
	cfg := NewConfig(s.dataDir)
	c.Assert(s.dataDir, T.Equals, cfg.DataDir)
}
예제 #5
0
func (s *ConfigSuite) TestDataDirPath(c *T.C) {
	cfg := NewConfig(s.dataDir)
	c.Assert(filepath.Join(s.dataDir, configName), T.Equals, cfg.ConfigPath())
}