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) }
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 }
func (s *ConfigSuite) TestConfigSetup(c *T.C) { cfg := NewConfig(s.dataDir) cfg.Setup() c.Assert(filepath.Join(s.dataDir, blobName), fileExists) }
func (s *ConfigSuite) TestNewConfig(c *T.C) { cfg := NewConfig(s.dataDir) c.Assert(s.dataDir, T.Equals, cfg.DataDir) }
func (s *ConfigSuite) SetUpTest(c *T.C) { s.dataDir = c.MkDir() }
func (s *ConfigSuite) TestFailing(c *T.C) { c.Error(1) }
func (s *ConfigSuite) TestDataDirPath(c *T.C) { cfg := NewConfig(s.dataDir) c.Assert(filepath.Join(s.dataDir, configName), T.Equals, cfg.ConfigPath()) }