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


Golang gocheck.Not函数代码示例

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


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

示例1: TestGetAutoLoginUser

func (*testWrapper) TestGetAutoLoginUser(c *C.C) {
	name, err := getLightdmAutoLoginUser("testdata/autologin/lightdm_autologin.conf")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "wen")
	name, err = getLightdmAutoLoginUser("testdata/autologin/lightdm.conf")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "")
	_, err = getLightdmAutoLoginUser("testdata/autologin/xxxxx.conf")
	c.Check(err, C.Not(C.Equals), nil)

	name, err = getGDMAutoLoginUser("testdata/autologin/custom_autologin.conf")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "wen")
	name, err = getGDMAutoLoginUser("testdata/autologin/custom.conf")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "")
	_, err = getGDMAutoLoginUser("testdata/autologin/xxxx.conf")
	c.Check(err, C.Not(C.Equals), nil)

	name, err = getKDMAutoLoginUser("testdata/autologin/kdmrc_autologin")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "wen")
	name, err = getKDMAutoLoginUser("testdata/autologin/kdmrc")
	c.Check(err, C.Equals, nil)
	c.Check(name, C.Equals, "")
	_, err = getKDMAutoLoginUser("testdata/autologin/xxxxx")
	c.Check(err, C.Not(C.Equals), nil)

	m, err := getDefaultDisplayManager("testdata/autologin/default-display-manager")
	c.Check(err, C.Equals, nil)
	c.Check(m, C.Equals, "lightdm")
	_, err = getDefaultDisplayManager("testdata/autologin/xxxxx")
	c.Check(err, C.Not(C.Equals), nil)
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:34,代码来源:users_test.go

示例2: TestPasswordValidUpdatesSalt

func (s *UserSuite) TestPasswordValidUpdatesSalt(c *gc.C) {
	user := s.factory.MakeAnyUser()

	compatHash := utils.UserPasswordHash("foo", utils.CompatSalt)
	err := user.SetPasswordHash(compatHash, "")
	c.Assert(err, gc.IsNil)
	beforeSalt, beforeHash := state.GetUserPasswordSaltAndHash(user)
	c.Assert(beforeSalt, gc.Equals, "")
	c.Assert(beforeHash, gc.Equals, compatHash)
	c.Assert(user.PasswordValid("bar"), jc.IsFalse)
	// A bad password doesn't trigger a rewrite
	afterBadSalt, afterBadHash := state.GetUserPasswordSaltAndHash(user)
	c.Assert(afterBadSalt, gc.Equals, "")
	c.Assert(afterBadHash, gc.Equals, compatHash)
	// When we get a valid check, we then add a salt and rewrite the hash
	c.Assert(user.PasswordValid("foo"), jc.IsTrue)
	afterSalt, afterHash := state.GetUserPasswordSaltAndHash(user)
	c.Assert(afterSalt, gc.Not(gc.Equals), "")
	c.Assert(afterHash, gc.Not(gc.Equals), compatHash)
	c.Assert(afterHash, gc.Equals, utils.UserPasswordHash("foo", afterSalt))
	// running PasswordValid again doesn't trigger another rewrite
	c.Assert(user.PasswordValid("foo"), jc.IsTrue)
	lastSalt, lastHash := state.GetUserPasswordSaltAndHash(user)
	c.Assert(lastSalt, gc.Equals, afterSalt)
	c.Assert(lastHash, gc.Equals, afterHash)
}
开发者ID:rogpeppe,项目名称:juju,代码行数:26,代码来源:user_test.go

示例3: TestIsEmpty

func (s *ConstraintsSuite) TestIsEmpty(c *gc.C) {
	con := constraints.Value{}
	c.Check(&con, jc.Satisfies, constraints.IsEmpty)
	con = constraints.MustParse("arch=amd64")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("")
	c.Check(&con, jc.Satisfies, constraints.IsEmpty)
	con = constraints.MustParse("tags=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("networks=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("mem=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("arch=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("root-disk=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("cpu-power=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("cpu-cores=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("container=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
	con = constraints.MustParse("instance-type=")
	c.Check(&con, gc.Not(jc.Satisfies), constraints.IsEmpty)
}
开发者ID:jiasir,项目名称:juju,代码行数:26,代码来源:constraints_test.go

示例4: TestResolveMetadata

func (*metadataHelperSuite) TestResolveMetadata(c *gc.C) {
	var versionStrings = []string{"1.2.3-precise-amd64"}
	dir := c.MkDir()
	ttesting.MakeTools(c, dir, "releases", versionStrings)
	toolsList := coretools.List{{
		Version: version.MustParseBinary(versionStrings[0]),
		Size:    123,
		SHA256:  "abc",
	}}

	stor, err := filestorage.NewFileStorageReader(dir)
	c.Assert(err, gc.IsNil)
	err = tools.ResolveMetadata(stor, nil)
	c.Assert(err, gc.IsNil)

	// We already have size/sha256, so ensure that storage isn't consulted.
	countingStorage := &countingStorage{StorageReader: stor}
	metadata := tools.MetadataFromTools(toolsList)
	err = tools.ResolveMetadata(countingStorage, metadata)
	c.Assert(err, gc.IsNil)
	c.Assert(countingStorage.counter, gc.Equals, 0)

	// Now clear size/sha256, and check that it is called, and
	// the size/sha256 sum are updated.
	metadata[0].Size = 0
	metadata[0].SHA256 = ""
	err = tools.ResolveMetadata(countingStorage, metadata)
	c.Assert(err, gc.IsNil)
	c.Assert(countingStorage.counter, gc.Equals, 1)
	c.Assert(metadata[0].Size, gc.Not(gc.Equals), 0)
	c.Assert(metadata[0].SHA256, gc.Not(gc.Equals), "")
}
开发者ID:jameinel,项目名称:core,代码行数:32,代码来源:simplestreams_test.go

示例5: TestNewContainer

func (s *S) TestNewContainer(c *gocheck.C) {
	oldClusterNodes := clusterNodes
	clusterNodes = map[string]string{"server": s.server.URL()}
	defer func() { clusterNodes = oldClusterNodes }()
	app := testing.NewFakeApp("app-name", "brainfuck", 1)
	rtesting.FakeRouter.AddBackend(app.GetName())
	defer rtesting.FakeRouter.RemoveBackend(app.GetName())
	dockerCluster().PullImage(
		docker.PullImageOptions{Repository: "tsuru/brainfuck"},
		docker.AuthConfiguration{},
	)
	cont, err := newContainer(app, getImage(app), []string{"docker", "run"})
	c.Assert(err, gocheck.IsNil)
	defer s.removeTestContainer(&cont)
	c.Assert(cont.ID, gocheck.Not(gocheck.Equals), "")
	c.Assert(cont, gocheck.FitsTypeOf, container{})
	c.Assert(cont.AppName, gocheck.Equals, app.GetName())
	c.Assert(cont.Type, gocheck.Equals, app.GetPlatform())
	c.Assert(cont.Name, gocheck.Not(gocheck.Equals), "")
	c.Assert(cont.Name, gocheck.HasLen, 20)
	u, _ := url.Parse(s.server.URL())
	host, _, _ := net.SplitHostPort(u.Host)
	c.Assert(cont.HostAddr, gocheck.Equals, host)
	user, err := config.GetString("docker:ssh:user")
	c.Assert(err, gocheck.IsNil)
	dcli, _ := docker.NewClient(s.server.URL())
	container, err := dcli.InspectContainer(cont.ID)
	c.Assert(err, gocheck.IsNil)
	c.Assert(container.Config.User, gocheck.Equals, user)
}
开发者ID:richardsonlima,项目名称:tsuru,代码行数:30,代码来源:docker_test.go

示例6: TestCreateLoadBalancer

func (s *S) TestCreateLoadBalancer(c *gocheck.C) {
	testServer.PrepareResponse(200, nil, CreateLoadBalancer)
	createLB := &elb.CreateLoadBalancer{
		Name:       "testlb",
		AvailZones: []string{"us-east-1a", "us-east-1b"},
		Listeners: []elb.Listener{
			{
				InstancePort:     80,
				InstanceProtocol: "http",
				Protocol:         "http",
				LoadBalancerPort: 80,
			},
		},
	}
	resp, err := s.elb.CreateLoadBalancer(createLB)
	c.Assert(err, gocheck.IsNil)
	defer s.elb.DeleteLoadBalancer(createLB.Name)
	values := testServer.WaitRequest().URL.Query()
	c.Assert(values.Get("Version"), gocheck.Equals, "2012-06-01")
	c.Assert(values.Get("Action"), gocheck.Equals, "CreateLoadBalancer")
	c.Assert(values.Get("Timestamp"), gocheck.Not(gocheck.Equals), "")
	c.Assert(values.Get("LoadBalancerName"), gocheck.Equals, "testlb")
	c.Assert(values.Get("AvailabilityZones.member.1"), gocheck.Equals, "us-east-1a")
	c.Assert(values.Get("AvailabilityZones.member.2"), gocheck.Equals, "us-east-1b")
	c.Assert(values.Get("Listeners.member.1.InstancePort"), gocheck.Equals, "80")
	c.Assert(values.Get("Listeners.member.1.InstanceProtocol"), gocheck.Equals, "http")
	c.Assert(values.Get("Listeners.member.1.Protocol"), gocheck.Equals, "http")
	c.Assert(values.Get("Listeners.member.1.LoadBalancerPort"), gocheck.Equals, "80")
	c.Assert(values.Get("Signature"), gocheck.Not(gocheck.Equals), "")
	c.Assert(resp.DNSName, gocheck.Equals, "testlb-339187009.us-east-1.elb.amazonaws.com")
}
开发者ID:newhouseb,项目名称:goamz,代码行数:31,代码来源:elb_test.go

示例7: TestConfigureHealthCheck

func (s *S) TestConfigureHealthCheck(c *gocheck.C) {
	testServer.PrepareResponse(200, nil, ConfigureHealthCheck)
	hc := elb.HealthCheck{
		HealthyThreshold:   10,
		Interval:           30,
		Target:             "HTTP:80/",
		Timeout:            5,
		UnhealthyThreshold: 2,
	}
	resp, err := s.elb.ConfigureHealthCheck("testlb", &hc)
	c.Assert(err, gocheck.IsNil)
	values := testServer.WaitRequest().URL.Query()
	c.Assert(values.Get("Version"), gocheck.Equals, "2012-06-01")
	c.Assert(values.Get("Signature"), gocheck.Not(gocheck.Equals), "")
	c.Assert(values.Get("Timestamp"), gocheck.Not(gocheck.Equals), "")
	c.Assert(values.Get("Action"), gocheck.Equals, "ConfigureHealthCheck")
	c.Assert(values.Get("LoadBalancerName"), gocheck.Equals, "testlb")
	c.Assert(values.Get("HealthCheck.HealthyThreshold"), gocheck.Equals, "10")
	c.Assert(values.Get("HealthCheck.Interval"), gocheck.Equals, "30")
	c.Assert(values.Get("HealthCheck.Target"), gocheck.Equals, "HTTP:80/")
	c.Assert(values.Get("HealthCheck.Timeout"), gocheck.Equals, "5")
	c.Assert(values.Get("HealthCheck.UnhealthyThreshold"), gocheck.Equals, "2")
	c.Assert(resp.HealthCheck.HealthyThreshold, gocheck.Equals, 10)
	c.Assert(resp.HealthCheck.Interval, gocheck.Equals, 30)
	c.Assert(resp.HealthCheck.Target, gocheck.Equals, "HTTP:80/")
	c.Assert(resp.HealthCheck.Timeout, gocheck.Equals, 5)
	c.Assert(resp.HealthCheck.UnhealthyThreshold, gocheck.Equals, 2)
}
开发者ID:newhouseb,项目名称:goamz,代码行数:28,代码来源:elb_test.go

示例8: TestParseNoTagsNoNetworks

func (s *ConstraintsSuite) TestParseNoTagsNoNetworks(c *gc.C) {
	con := constraints.MustParse("arch=amd64 mem=4G cpu-cores=1 root-disk=8G tags= networks=")
	c.Assert(con.Tags, gc.Not(gc.IsNil))
	c.Assert(con.Networks, gc.Not(gc.IsNil))
	c.Check(*con.Tags, gc.HasLen, 0)
	c.Check(*con.Networks, gc.HasLen, 0)
}
开发者ID:jiasir,项目名称:juju,代码行数:7,代码来源:constraints_test.go

示例9: TestExportEnvironmentsForward

func (s *S) TestExportEnvironmentsForward(c *gocheck.C) {
	expectedHost := "localhost"
	config.Set("host", expectedHost)
	app := App{Name: "mist", Platform: "opeth"}
	err := s.conn.Apps().Insert(app)
	c.Assert(err, gocheck.IsNil)
	defer s.conn.Apps().Remove(bson.M{"name": app.Name})
	ctx := action.FWContext{Params: []interface{}{&app}}
	result, err := exportEnvironmentsAction.Forward(ctx)
	c.Assert(err, gocheck.IsNil)
	c.Assert(result, gocheck.Equals, nil)
	gotApp, err := GetByName(app.Name)
	c.Assert(err, gocheck.IsNil)
	appEnv := gotApp.InstanceEnv("")
	c.Assert(appEnv["TSURU_APPNAME"].Value, gocheck.Equals, app.Name)
	c.Assert(appEnv["TSURU_APPNAME"].Public, gocheck.Equals, false)
	c.Assert(appEnv["TSURU_HOST"].Value, gocheck.Equals, expectedHost)
	c.Assert(appEnv["TSURU_HOST"].Public, gocheck.Equals, false)
	c.Assert(appEnv["TSURU_APP_TOKEN"].Value, gocheck.Not(gocheck.Equals), "")
	c.Assert(appEnv["TSURU_APP_TOKEN"].Public, gocheck.Equals, false)
	c.Assert(appEnv["TSURU_APPDir"].Value, gocheck.Not(gocheck.Equals), "/home/application/current")
	c.Assert(appEnv["TSURU_APPDir"].Public, gocheck.Equals, false)
	t, err := nativeScheme.Auth(appEnv["TSURU_APP_TOKEN"].Value)
	c.Assert(err, gocheck.IsNil)
	c.Assert(t.IsAppToken(), gocheck.Equals, true)
	c.Assert(t.GetAppName(), gocheck.Equals, app.Name)
}
开发者ID:rualatngua,项目名称:tsuru,代码行数:27,代码来源:actions_test.go

示例10: TestGetLocale

func (t *TestWrapper) TestGetLocale(c *C.C) {
	l, err := getLocaleFromFile("testdata/pam_environment")
	c.Check(err, C.Not(C.NotNil))
	c.Check(l, C.Equals, "zh_CN.UTF-8")

	l = getLocale()
	c.Check(len(l), C.Not(C.Equals), 0)
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:8,代码来源:locale_test.go

示例11: TestSystemMemory

func (*testWrapper) TestSystemMemory(c *C.C) {
	mem, err := getMemoryCapFromFile("/proc/meminfo")
	c.Check(err, C.Not(C.NotNil))
	c.Check(mem, C.Not(C.Equals), uint64(0))
	mem, err = getMemoryCapFromFile("xxxxxxxxx")
	c.Check(err, C.NotNil)
	c.Check(mem, C.Equals, uint64(0))
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:8,代码来源:system_test.go

示例12: TestAddUserSetsSalt

func (s *UserSuite) TestAddUserSetsSalt(c *gc.C) {
	user := s.factory.MakeUser(factory.UserParams{Password: "a-password"})
	salt, hash := state.GetUserPasswordSaltAndHash(user)
	c.Check(hash, gc.Not(gc.Equals), "")
	c.Check(salt, gc.Not(gc.Equals), "")
	c.Check(utils.UserPasswordHash("a-password", salt), gc.Equals, hash)
	c.Check(user.PasswordValid("a-password"), jc.IsTrue)
}
开发者ID:rogpeppe,项目名称:juju,代码行数:8,代码来源:user_test.go

示例13: TestSystemCPU

func (*testWrapper) TestSystemCPU(c *C.C) {
	cpu, err := getCPUInfoFromFile("/proc/cpuinfo")
	c.Check(err, C.Not(C.NotNil))
	c.Check(len(cpu), C.Not(C.Equals), 0)
	cpu, err = getCPUInfoFromFile("xxxxxxxxxxx")
	c.Check(err, C.NotNil)
	c.Check(cpu, C.Equals, "")
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:8,代码来源:system_test.go

示例14: TestLayoutList

func (*testWrapper) TestLayoutList(c *C.C) {
	v, err := getLayoutListByFile("testdata/base.xml")
	c.Check(err, C.Not(C.NotNil))
	c.Check(v, C.NotNil)

	v, err = getLayoutListByFile("testdata/xxxxxx.xml")
	c.Check(err, C.NotNil)
	c.Check(v, C.Not(C.NotNil))
}
开发者ID:felixonmars,项目名称:dde-daemon,代码行数:9,代码来源:keyboard_test.go

示例15: TestWithConfigAndNoInfo

func (s *NewAPIClientSuite) TestWithConfigAndNoInfo(c *gc.C) {
	coretesting.MakeSampleJujuHome(c)

	store := newConfigStore(coretesting.SampleEnvName, &environInfo{
		bootstrapConfig: map[string]interface{}{
			"type":                      "dummy",
			"name":                      "myenv",
			"state-server":              true,
			"authorized-keys":           "i-am-a-key",
			"default-series":            config.LatestLtsSeries(),
			"firewall-mode":             config.FwInstance,
			"development":               false,
			"ssl-hostname-verification": true,
			"admin-secret":              "adminpass",
		},
	})
	bootstrapEnv(c, coretesting.SampleEnvName, store)

	// Verify the cache is empty.
	info, err := store.ReadInfo("myenv")
	c.Assert(err, gc.IsNil)
	c.Assert(info, gc.NotNil)
	c.Assert(info.APIEndpoint(), jc.DeepEquals, configstore.APIEndpoint{})
	c.Assert(info.APICredentials(), jc.DeepEquals, configstore.APICredentials{})

	called := 0
	expectState := mockedAPIState(0)
	apiOpen := func(apiInfo *api.Info, opts api.DialOpts) (juju.APIState, error) {
		c.Check(apiInfo.Tag, gc.Equals, names.NewUserTag("admin"))
		c.Check(string(apiInfo.CACert), gc.Not(gc.Equals), "")
		c.Check(apiInfo.Password, gc.Equals, "adminpass")
		// EnvironTag wasn't in regular Config
		c.Check(apiInfo.EnvironTag, gc.IsNil)
		c.Check(opts, gc.DeepEquals, api.DefaultDialOpts())
		called++
		return expectState, nil
	}
	st, err := juju.NewAPIFromStore("myenv", store, apiOpen)
	c.Assert(err, gc.IsNil)
	c.Assert(st, gc.Equals, expectState)
	c.Assert(called, gc.Equals, 1)

	// Make sure the cache is updated.
	info, err = store.ReadInfo("myenv")
	c.Assert(err, gc.IsNil)
	c.Assert(info, gc.NotNil)
	ep := info.APIEndpoint()
	c.Assert(ep.Addresses, gc.HasLen, 1)
	c.Check(ep.Addresses[0], gc.Matches, `localhost:\d+`)
	c.Check(ep.CACert, gc.Not(gc.Equals), "")
	// Old servers won't hand back EnvironTag, so it should stay empty in
	// the cache
	c.Check(ep.EnvironUUID, gc.Equals, "")
	creds := info.APICredentials()
	c.Check(creds.User, gc.Equals, "admin")
	c.Check(creds.Password, gc.Equals, "adminpass")
}
开发者ID:klyachin,项目名称:juju,代码行数:57,代码来源:api_test.go


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