当前位置: 首页>>代码示例>>Golang>>正文


Golang C.ExpectFailure方法代码示例

本文整理汇总了Golang中launchpad/net/gocheck.C.ExpectFailure方法的典型用法代码示例。如果您正苦于以下问题:Golang C.ExpectFailure方法的具体用法?Golang C.ExpectFailure怎么用?Golang C.ExpectFailure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在launchpad/net/gocheck.C的用法示例。


在下文中一共展示了C.ExpectFailure方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TestEntriesCreateFailure

func (s *EntrySuite) TestEntriesCreateFailure(c *gc.C) {
	c.ExpectFailure("cannot create an entry")
	ft.Entries{
		ft.File{"good", "good", 0750},
		ft.File{"nodir/bad", "bad", 0640},
	}.Create(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:7,代码来源:filetesting_test.go

示例2: TestRemovedCreateFailure

func (s *EntrySuite) TestRemovedCreateFailure(c *gc.C) {
	ft.File{"some-file", "content", 0644}.Create(c, s.basePath)
	os.Chmod(s.basePath, 0444)
	defer os.Chmod(s.basePath, 0777)
	c.ExpectFailure("should fail to remove file")
	ft.Removed{"some-file"}.Create(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:7,代码来源:filetesting_test.go

示例3: TestEntriesCheckFailure

func (s *EntrySuite) TestEntriesCheckFailure(c *gc.C) {
	goodFile := ft.File{"good", "good", 0751}.Create(c, s.basePath)
	c.ExpectFailure("entry does not exist")
	ft.Entries{
		goodFile,
		ft.File{"bad", "", 0750},
	}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:8,代码来源:filetesting_test.go

示例4: TestDebugLogAtUUIDLogPath

func (s *clientSuite) TestDebugLogAtUUIDLogPath(c *gc.C) {
	s.PatchValue(api.WebsocketDialConfig, echoURL(c))
	// If the server supports it, we should log at "/environment/UUID/log"
	environ, err := s.State.Environment()
	c.Assert(err, gc.IsNil)
	info := s.APIInfo(c)
	info.EnvironTag = environ.Tag()
	apistate, err := api.Open(info, api.DialOpts{})
	c.Assert(err, gc.IsNil)
	defer apistate.Close()
	reader, err := apistate.Client().WatchDebugLog(api.DebugLogParams{})
	c.Assert(err, gc.IsNil)
	connectURL := connectURLFromReader(c, reader)
	c.ExpectFailure("debug log always goes to /log for compatibility http://pad.lv/1326799")
	c.Assert(connectURL.Path, gc.Matches, fmt.Sprintf("/%s/log", environ.UUID()))
}
开发者ID:zhouqt,项目名称:juju,代码行数:16,代码来源:client_test.go

示例5: TestFileCheckFailureBadPerm

func (s *EntrySuite) TestFileCheckFailureBadPerm(c *gc.C) {
	ft.File{"furble", "pingle", 0644}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different perms")
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例6: TestFileCheckFailureBadData

func (s *EntrySuite) TestFileCheckFailureBadData(c *gc.C) {
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different content")
	ft.File{"furble", "wrongle", 0740}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例7: TestDirCheckFailureBadPerm

func (s *EntrySuite) TestDirCheckFailureBadPerm(c *gc.C) {
	ft.Dir{"furble", 0740}.Check(c, s.basePath)
	c.ExpectFailure("shouldn't pass with different perms")
	ft.Dir{"furble", 0755}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例8: TestFileCreateFailure

func (s *EntrySuite) TestFileCreateFailure(c *gc.C) {
	c.ExpectFailure("should fail to create file in missing dir")
	ft.File{"missing/foobar", "hello", 0644}.Create(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:4,代码来源:filetesting_test.go

示例9: TestRemovedCheckFailureSymlink

func (s *EntrySuite) TestRemovedCheckFailureSymlink(c *gc.C) {
	ft.Symlink{"some-link", "target"}.Create(c, s.basePath)
	c.ExpectFailure("should not accept symlink")
	ft.Removed{"some-link"}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例10: TestDirCheckFailureSymlink

func (s *EntrySuite) TestDirCheckFailureSymlink(c *gc.C) {
	ft.Symlink{"link", "dir"}.Create(c, s.basePath)
	ft.Dir{"dir", 0644}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't accept symlink, even if pointing to matching dir")
	ft.Dir{"link", 0644}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:6,代码来源:filetesting_test.go

示例11: TestSucceed

func (s *ExpectFailureSucceedHelper) TestSucceed(c *gocheck.C) {
	c.ExpectFailure("It booms!")
	c.Error("Boom!")
}
开发者ID:evaluation-alex,项目名称:gosync,代码行数:4,代码来源:foundation_test.go

示例12: TestSymlinkCreateFailure

func (s *EntrySuite) TestSymlinkCreateFailure(c *gc.C) {
	c.ExpectFailure("should fail to create symlink in missing dir")
	ft.Symlink{"missing/link", "target"}.Create(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:4,代码来源:filetesting_test.go

示例13: TestSymlinkCheckFailureDir

func (s *EntrySuite) TestSymlinkCheckFailureDir(c *gc.C) {
	ft.Dir{"link", 0755}.Create(c, s.basePath)
	c.ExpectFailure("should not accept dir")
	ft.Symlink{"link", "different"}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例14: TestFileCheckFailureDir

func (s *EntrySuite) TestFileCheckFailureDir(c *gc.C) {
	ft.Dir{"furble", 0740}.Create(c, s.basePath)
	c.ExpectFailure("shouldn't accept dir")
	ft.File{"furble", "pingle", 0740}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go

示例15: TestSymlinkCheckFailureFile

func (s *EntrySuite) TestSymlinkCheckFailureFile(c *gc.C) {
	ft.File{"link", "target", 0644}.Create(c, s.basePath)
	c.ExpectFailure("should not accept plain file")
	ft.Symlink{"link", "target"}.Check(c, s.basePath)
}
开发者ID:jimmiebtlr,项目名称:testing,代码行数:5,代码来源:filetesting_test.go


注:本文中的launchpad/net/gocheck.C.ExpectFailure方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。