Exemplo n.º 1
0
func TestUserDocker(t *testing.T) {
	assert := require.New(t)

	config := &CloudConfig{
		Rancher: RancherConfig{
			UserDocker: DockerConfig{
				TLS: true,
			},
		},
	}

	bytes, err := yaml.Marshal(config)
	assert.Nil(err)

	config = NewConfig()
	err = yaml.Unmarshal(bytes, config)
	assert.Nil(err)

	data := make(map[interface{}]map[interface{}]interface{})
	util.Convert(config, data)

	fmt.Println(data)

	val, ok := data["rancher"]["user_docker"]
	assert.True(ok)

	m, ok := val.(map[interface{}]interface{})
	assert.True(ok)
	v, ok := m["tls"]
	assert.True(ok)
	assert.True(v.(bool))

}
Exemplo n.º 2
0
// Tests the flow of AddMetricToMap where the metric name is not present in the map
func TestAddMetricToMapNewKey(t *testing.T) {
	var (
		cluster         = newRealModel(time.Minute)
		metrics         = make(map[string]*daystore.DayStore)
		new_metric_name = "name_not_in_map"
		stamp           = time.Now().Round(cluster.resolution)
		zeroTime        = time.Time{}
		value           = uint64(1234567890)
		assert          = assert.New(t)
		require         = require.New(t)
	)

	// First Call: Add a new metric to the map
	assert.NoError(cluster.addMetricToMap(new_metric_name, stamp, value, metrics))

	// Second Call: Add a second metric to the map on a later time. Flushes previous metric.
	assert.NoError(cluster.addMetricToMap(new_metric_name, stamp.Add(time.Minute), value, metrics))
	new_ts := *metrics[new_metric_name]
	results := new_ts.Hour.Get(zeroTime, zeroTime)
	require.Len(results, 2)
	assert.Equal(results[0].Timestamp, stamp.Add(time.Minute))
	assert.Equal(roundToEpsilon(results[0].Value, defaultEpsilon), roundToEpsilon(value, defaultEpsilon))
	assert.Equal(results[1].Timestamp, stamp)
	assert.Equal(roundToEpsilon(results[1].Value, defaultEpsilon), roundToEpsilon(value, defaultEpsilon))

	// Second Call: addMetricToMap for a new key, cause TimeStore failure
	assert.NoError(cluster.addMetricToMap("other_metric", stamp, value, metrics))
	assert.Error(cluster.addMetricToMap("other_metric", stamp.Add(-time.Minute), value, metrics))
}
Exemplo n.º 3
0
func Test_Column_MapsSlice(t *testing.T) {
	r := require.New(t)

	c1 := columns.ColumnsForStruct(&foo{}, "foo")
	c2 := columns.ColumnsForStruct(&foos{}, "foo")
	r.Equal(c1.String(), c2.String())
}
Exemplo n.º 4
0
func TestGet(t *testing.T) {
	assert := require.New(t)

	data := map[interface{}]interface{}{
		"key": "value",
		"rancher": map[interface{}]interface{}{
			"key2": map[interface{}]interface{}{
				"subkey": "subvalue",
				"subnum": 42,
			},
		},
	}

	tests := map[string]interface{}{
		"key": "value",
		"rancher.key2.subkey":  "subvalue",
		"rancher.key2.subnum":  42,
		"rancher.key2.subkey2": "",
		"foo": "",
	}

	for k, v := range tests {
		assert.Equal(v, getOrSetVal(k, data, nil))
	}
}
Exemplo n.º 5
0
func Test_Request_URL_Params(t *testing.T) {
	r := require.New(t)
	w := willy.New(App())

	req := w.Request("/foo?a=%s&b=%s", "A", "B")
	r.Equal("/foo?a=A&b=B", req.URL)
}
Exemplo n.º 6
0
// TestCli runs tests on the zest Cli and SetCli methods.
func TestCli(t *testing.T) {
	a := assert.New(t)
	r := require.New(t)
	zest := New()

	r.NotPanics(func() { _ = zest.Cli() })
	cli := zest.Cli()

	cli.Name = "foobar"
	zest.SetCli(cli)

	r.NotPanics(func() { _ = zest.Cli() })
	cli = zest.Cli()

	a.Equal("foobar", cli.Name)

	zest = Classic() // should also work with the Classic zest

	r.NotPanics(func() { _ = zest.Cli() })
	cli = zest.Cli()

	cli.Name = "foobar"
	zest.SetCli(cli)

	r.NotPanics(func() { _ = zest.Cli() })
	cli = zest.Cli()

	a.Equal("foobar", cli.Name)
}
Exemplo n.º 7
0
// TestRegister runs tests on the syringe Register method.
func TestRegister(t *testing.T) {
	a := assert.New(t)
	r := require.New(t)
	syringe := New()

	deps := []interface{}{
		newDep1,
		newDep2,
	}

	syringe.Register(deps)
	r.NotPanics(func() { _ = syringe.deps[0]; _ = syringe.deps[1] })
	a.IsType(newDep1, syringe.deps[0])
	a.IsType(newDep2, syringe.deps[1])

	syringe.Register(newDep3, newDep4)
	r.NotPanics(func() { _ = syringe.deps[2]; _ = syringe.deps[3] })
	a.IsType(newDep3, syringe.deps[2])
	a.IsType(newDep4, syringe.deps[3])

	syringe.Register(newDep4)
	r.NotPanics(func() { _ = syringe.deps[4] })
	a.IsType(newDep4, syringe.deps[4])

	syringe.Register(newDep4())
	r.NotPanics(func() { _ = syringe.deps[5] })
	a.IsType(&dep4{}, syringe.deps[5])
}
Exemplo n.º 8
0
//
//
// Unit TestCases
//
//
func TestIsPrefixHeader(t *testing.T) {
	assert := require.New(t)

	tests := map[string]bool{
		"$":               false,
		"#header 1":       true,
		"# header 1":      true,
		"#######header 7": true,
	}

	p := new(parser)
	for key, value := range tests {
		assert.Equal(p.isPrefixHeader([]byte(key)), value)
	}

	testsExtSpaceHeader := map[string]bool{
		"$":                false,
		"# ":               true,
		"#header 1":        false,
		"####### header 7": false,
		"# header 1":       true,
		"### header 3":     true,
		"# he":             true,
	}
	p1 := new(parser)
	p1.flags |= EXTENSION_SPACE_HEADERS
	for key, value := range testsExtSpaceHeader {
		assert.Equal(p1.isPrefixHeader([]byte(key)), value)
	}
}
Exemplo n.º 9
0
func TestParseCmdline(t *testing.T) {
	assert := require.New(t)

	expected := map[interface{}]interface{}{
		"rancher": map[interface{}]interface{}{
			"rescue":   true,
			"key1":     "value1",
			"key2":     "value2",
			"keyArray": []interface{}{int64(1), int64(2)},
			"obj1": map[interface{}]interface{}{
				"key3": "3value",
				"obj2": map[interface{}]interface{}{
					"key4": true,
				},
			},
			"key5": int64(5),
			"key6": "a,b",
			"key7": "a\nb",
		},
	}

	actual := parseCmdline("a b rancher.rescue rancher.keyArray=[1,2] rancher.key1=value1 c rancher.key2=value2 rancher.obj1.key3=3value rancher.obj1.obj2.key4 rancher.key5=5 rancher.key6=a,b rancher.key7=a\nb")

	assert.Equal(expected, actual)
}
Exemplo n.º 10
0
func TestRepo(t *testing.T) {
	scenarios.Load(tdb.StellarCoreURL(), "base-core.sql")
	assert := assert.New(t)
	require := require.New(t)
	repo := &Repo{DB: tdb.StellarCore()}

	var count int
	err := repo.GetRaw(&count, "SELECT COUNT(*) FROM txhistory")
	assert.NoError(err)
	assert.Equal(4, count)

	var ids []string
	err = repo.SelectRaw(&ids, "SELECT txid FROM txhistory")
	assert.NoError(err)
	assert.Len(ids, 4)

	ret, err := repo.ExecRaw("DELETE FROM txhistory")
	assert.NoError(err)
	deleted, err := ret.RowsAffected()
	assert.NoError(err)
	assert.Equal(int64(4), deleted)

	// Test args
	var hash string
	err = repo.GetRaw(&hash, "SELECT prevhash FROM ledgerheaders WHERE ledgerseq = ?", 1)
	assert.NoError(err)
	assert.Equal("0000000000000000000000000000000000000000000000000000000000000000", hash)

	// Test NoRows
	err = repo.GetRaw(&hash, "SELECT prevhash FROM ledgerheaders WHERE ledgerseq = ?", 100)
	assert.True(repo.NoRows(err))

	// Test transactions
	require.NoError(repo.Begin(), "begin failed")
	err = repo.GetRaw(&count, "SELECT COUNT(*) FROM ledgerheaders")
	assert.NoError(err)
	assert.Equal(3, count)
	_, err = repo.ExecRaw("DELETE FROM ledgerheaders")
	assert.NoError(err)
	err = repo.GetRaw(&count, "SELECT COUNT(*) FROM ledgerheaders")
	assert.NoError(err)
	assert.Equal(0, count, "Ledgers did not appear deleted inside transaction")
	assert.NoError(repo.Rollback(), "rollback failed")

	// Ensure commit works
	require.NoError(repo.Begin(), "begin failed")
	repo.ExecRaw("DELETE FROM ledgerheaders")
	assert.NoError(repo.Commit(), "commit failed")
	err = repo.GetRaw(&count, "SELECT COUNT(*) FROM ledgerheaders")
	assert.NoError(err)
	assert.Equal(0, count)

	// ensure that selecting into a populated slice clears the slice first
	scenarios.Load(tdb.StellarCoreURL(), "base-core.sql")
	require.Len(ids, 4, "ids slice was not preloaded with data")
	err = repo.SelectRaw(&ids, "SELECT txid FROM txhistory limit 2")
	assert.NoError(err)
	assert.Len(ids, 2)

}
Exemplo n.º 11
0
func Test_WillieSessions(t *testing.T) {
	r := require.New(t)
	w := willie.New(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) {
		defer context.Clear(req)
		sess, _ := Store.Get(req, "my-session")
		t := sess.Values["foo"]
		fmt.Printf("t: %s\n", t)
		if t != nil {
			res.WriteHeader(200)
			fmt.Fprint(res, t)
		} else {
			sess.Values["foo"] = "bar"
			sess.Save(req, res)
			res.WriteHeader(201)
			fmt.Fprint(res, "setting session")
		}
	}))

	res := w.Get("/", nil)
	r.Equal(201, res.Code)
	r.Equal("setting session", res.Body.String())

	res = w.Get("/", nil)
	r.Equal(200, res.Code)
	r.Equal("bar", res.Body.String())
}
Exemplo n.º 12
0
func TestTests_Detail_OK(t *testing.T) {
	assert := assert.New(t)
	require := require.New(t)

	c := &fakeAPIClient{
		fixture: "tests_detail_ok.json",
	}
	tt := newTests(c)

	test, err := tt.Detail(1234)
	require.Nil(err)

	assert.Equal("/Tests/Details", c.sentRequestPath)
	assert.Equal("GET", c.sentRequestMethod)
	assert.Equal(url.Values{"TestID": {"1234"}}, c.sentRequestValues)

	assert.Equal(test.TestID, 6735)
	assert.Equal(test.TestType, "HTTP")
	assert.Equal(test.Paused, false)
	assert.Equal(test.WebsiteName, "NL")
	assert.Equal(test.ContactID, 536)
	assert.Equal(test.Status, "Up")
	assert.Equal(test.Uptime, 0.0)
	assert.Equal(test.CheckRate, 60)
	assert.Equal(test.Timeout, 40)
	assert.Equal(test.LogoImage, "")
	assert.Equal(test.WebsiteHost, "Various")
	assert.Equal(test.FindString, "")
	assert.Equal(test.DoNotFind, false)
}
Exemplo n.º 13
0
func Test_Client_Save_MultiHost(t *testing.T) {
	r := require.New(t)

	ms := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		s := SimpleSaveable{Message: "Primary"}
		json.NewEncoder(w).Encode(s)
		w.WriteHeader(200)
	}))
	defer ms.Close()
	ss := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		s := SimpleSaveable{Message: "Slave"}
		json.NewEncoder(w).Encode(s)
		w.WriteHeader(404)
	}))
	defer ms.Close()

	c, err := client.New([]*client.Host{
		{URL: ms.URL, Primary: true},
		{URL: ss.URL},
	})
	r.NoError(err)

	s := &SimpleSaveable{}
	res, err := c.Save(s)
	r.NoError(err)
	r.Equal(200, res.StatusCode)
	r.Equal("Primary", s.Message)
}
Exemplo n.º 14
0
func Test_New_RespectsPrimary(t *testing.T) {
	r := require.New(t)
	c, err := client.New([]*client.Host{{}, {Primary: true}})
	r.NoError(err)
	r.False(c.Hosts[0].Primary)
	r.True(c.Hosts[1].Primary)
}
func TestSoftRequirementsValidationSuccess(t *testing.T) {
	req := require.New(t)
	tempDir, err := ioutil.TempDir("", "")
	req.NoError(err)
	req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_period_us"), []byte("0"), os.ModePerm))
	req.NoError(ioutil.WriteFile(path.Join(tempDir, "cpu.cfs_quota_us"), []byte("0"), os.ModePerm))
	mountInt := &fakeMountInterface{
		[]mount.MountPoint{
			{
				Device: "cgroup",
				Type:   "cgroup",
				Opts:   []string{"rw", "relatime", "cpuset"},
			},
			{
				Device: "cgroup",
				Type:   "cgroup",
				Opts:   []string{"rw", "relatime", "cpu"},
				Path:   tempDir,
			},
			{
				Device: "cgroup",
				Type:   "cgroup",
				Opts:   []string{"rw", "relatime", "cpuacct", "memory"},
			},
		},
	}
	f, err := validateSystemRequirements(mountInt)
	assert.NoError(t, err)
	assert.True(t, f.cpuHardcapping, "cpu hardcapping is expected to be enabled")
}
Exemplo n.º 16
0
func Test_Client_Register(t *testing.T) {
	r := require.New(t)

	ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
		p := client.Product{Token: "token", Secret: "secret"}
		json.NewEncoder(w).Encode(p)
		w.WriteHeader(200)
	}))
	defer ts.Close()

	h := &client.Host{URL: ts.URL, Primary: true}
	c, err := client.New([]*client.Host{h})
	r.NoError(err)

	p := &client.Product{}
	res, err := c.Register(p)
	r.NoError(err)
	r.Equal(200, res.StatusCode)

	r.Equal("token", p.Token)
	r.Equal("secret", p.Secret)

	r.Equal("token", h.Token)
	r.Equal("secret", h.SecretKey)
}
Exemplo n.º 17
0
func Test_Pagination(t *testing.T) {
	transaction(func(tx *pop.Connection) {
		a := require.New(t)

		for _, name := range []string{"Mark", "Joe", "Jane"} {
			user := User{Name: nulls.NewString(name)}
			err := tx.Create(&user)
			a.NoError(err)
		}

		u := Users{}
		q := tx.Paginate(1, 2)
		err := q.All(&u)
		a.NoError(err)
		a.Equal(len(u), 2)

		p := q.Paginator
		a.Equal(p.CurrentEntriesSize, 2)
		a.Equal(p.TotalEntriesSize, 3)
		a.Equal(p.TotalPages, 2)

		u = Users{}
		err = tx.Where("name = 'Mark'").All(&u)
		a.NoError(err)
		a.Equal(reflect.ValueOf(&u).Elem().Len(), 1)
	})
}
Exemplo n.º 18
0
func TestMapsUnion(t *testing.T) {
	assert := require.New(t)

	m0 := map[interface{}]interface{}{
		"a": 1,
		"b": map[interface{}]interface{}{"c": 3},
		"d": "4",
		"f": []interface{}{1, 2, 3},
	}
	m1 := MapCopy(m0)
	m1["e"] = "added"
	m1["d"] = "replaced"
	m1["f"] = []interface{}{2, 3, 4}

	delete(m0, "a")
	b1 := m1["b"].(map[interface{}]interface{})
	delete(b1, "c")
	expected := map[interface{}]interface{}{
		"a": 1,
		"b": map[interface{}]interface{}{"c": 3},
		"d": "replaced",
		"e": "added",
		"f": []interface{}{2, 3, 4},
	}
	assert.Equal(expected, MapsUnion(m0, m1))
}
Exemplo n.º 19
0
func TestMapsDifference(t *testing.T) {
	assert := require.New(t)

	m0 := map[interface{}]interface{}{
		"a": 1,
		"b": map[interface{}]interface{}{"c": 3},
		"d": "4",
		"e": []interface{}{1, 2, 3},
	}
	m1 := MapCopy(m0)

	assert.Equal(map[interface{}]interface{}{}, MapsDifference(m0, m0))
	assert.Equal(map[interface{}]interface{}{}, MapsDifference(m0, m1))

	delete(m1, "a")
	b1 := m1["b"].(map[interface{}]interface{})
	delete(b1, "c")
	m1["e"] = []interface{}{2, 3, 4}

	expectedM1M0 := map[interface{}]interface{}{"b": map[interface{}]interface{}{}, "e": []interface{}{2, 3, 4}}
	assert.Equal(expectedM1M0, MapsDifference(m1, m0))

	expectedM0M1 := map[interface{}]interface{}{"a": 1, "b": map[interface{}]interface{}{"c": 3}, "e": []interface{}{1, 2, 3}}
	assert.Equal(expectedM0M1, MapsDifference(m0, m1))
}
Exemplo n.º 20
0
func testDelete(t *testing.T) {
	assert := require.New(t)

	c := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		Cmd: "--rm busybox echo hi",
	}).Parse()

	assert.False(c.Exists())
	assert.NoError(c.Err, "")

	c.Start()
	assert.NoError(c.Err, "")
	c.Reset()
	assert.NoError(c.Err, "")

	assert.True(c.Exists())
	assert.NoError(c.Err, "")

	c.Delete()
	assert.NoError(c.Err, "")

	c.Reset()
	assert.False(c.Exists())
	assert.NoError(c.Err, "")
}
Exemplo n.º 21
0
func testDockerClientNames(t *testing.T) {
	assert := require.New(t)
	client, err := dockerClient.NewClient(config.DOCKER_HOST)

	assert.NoError(err, "")

	c, err := client.CreateContainer(dockerClient.CreateContainerOptions{
		Name: "foo",
		Config: &dockerClient.Config{
			Image: "ubuntu",
		},
	})

	assert.NoError(err, "")
	assert.Equal("foo", c.Name)

	c2, err := client.InspectContainer(c.ID)

	assert.NoError(err, "")
	assert.Equal("/foo", c2.Name)

	c2, err = inspect(client, c.ID)

	assert.NoError(err, "")
	assert.Equal("foo", c2.Name)

	client.RemoveContainer(dockerClient.RemoveContainerOptions{
		ID:    c2.ID,
		Force: true,
	})
}
Exemplo n.º 22
0
func testRollback(t *testing.T) {
	assert := require.New(t)

	c := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		Cmd: "--name rollback busybox echo hi",
	}).Parse().Start().Lookup()

	assert.NoError(c.Err, "")
	assert.Equal("rollback", c.Container.Name)

	c2 := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		Cmd: "--name rollback busybox echo bye",
	}).Parse().Start().Lookup()

	assert.Equal("rollback", c2.Container.Name)
	assert.NoError(c2.Err, "")
	assert.NotEqual(c.Container.ID, c2.Container.ID)

	c3 := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		Cmd: "--name rollback busybox echo hi",
	}).Parse().Start().Lookup()

	assert.NoError(c3.Err, "")
	assert.Equal(c.Container.ID, c3.Container.ID)
	assert.Equal("rollback", c3.Container.Name)

	c2.Reset().Lookup()
	assert.NoError(c2.Err, "")
	assert.True(strings.HasPrefix(c2.Container.Name, "rollback-"))

	c.Delete()
	c2.Delete()
}
Exemplo n.º 23
0
func testLookup(t *testing.T) {
	assert := require.New(t)

	cfg := &config.ContainerConfig{
		Cmd: "--rm busybox echo hi",
	}
	c := NewContainer(config.DOCKER_HOST, cfg).Parse().Start()

	cfg2 := &config.ContainerConfig{
		Cmd: "--rm busybox echo hi2",
	}
	c2 := NewContainer(config.DOCKER_HOST, cfg2).Parse().Start()

	assert.NoError(c.Err, "")
	assert.NoError(c2.Err, "")

	c1Lookup := NewContainer(config.DOCKER_HOST, cfg).Lookup()
	c2Lookup := NewContainer(config.DOCKER_HOST, cfg2).Lookup()

	assert.NoError(c1Lookup.Err, "")
	assert.NoError(c2Lookup.Err, "")

	assert.Equal(c.Container.ID, c1Lookup.Container.ID, "")
	assert.Equal(c2.Container.ID, c2Lookup.Container.ID, "")

	c.Delete()
	c2.Delete()
}
Exemplo n.º 24
0
func testMigrateVolumes(t *testing.T) {
	assert := require.New(t)

	c := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		Cmd: "--name foo -v /test busybox echo hi",
	}).Parse().Start().Lookup()

	assert.NoError(c.Err, "")

	test_path, ok := c.Container.Volumes["/test"]
	assert.True(ok, "")

	c2 := NewContainer(config.DOCKER_HOST, &config.ContainerConfig{
		MigrateVolumes: true,
		Cmd:            "--name foo -v /test2 busybox echo hi",
	}).Parse().Start().Lookup()

	assert.NoError(c2.Err, "")

	assert.True(c2.Container != nil)

	_, ok = c2.Container.Volumes["/test2"]
	assert.True(ok, "")
	assert.Equal(test_path, c2.Container.Volumes["/test"])

	c.Delete()
	c2.Delete()
}
Exemplo n.º 25
0
func TestParse(t *testing.T) {
	assert := require.New(t)

	cfg := &config.ContainerConfig{
		Cmd: "--name c1 " +
			"-d " +
			"--rm " +
			"--privileged " +
			"test/image " +
			"arg1 " +
			"arg2 ",
	}

	c := NewContainer("", cfg).Parse()

	assert.NoError(c.Err, "")
	assert.Equal(cfg.Id, "c1", "Id doesn't match")
	assert.Equal(c.Name, "c1", "Name doesn't match")
	assert.True(c.remove, "Remove doesn't match")
	assert.True(c.detach, "Detach doesn't match")
	assert.Equal(c.Config.Cmd.Len(), 2, "Args doesn't match")
	assert.Equal(c.Config.Cmd.Slice()[0], "arg1", "Arg1 doesn't match")
	assert.Equal(c.Config.Cmd.Slice()[1], "arg2", "Arg2 doesn't match")
	assert.True(c.HostConfig.Privileged, "Privileged doesn't match")
}
Exemplo n.º 26
0
func TestConvertMergesLeftIntoRight(t *testing.T) {
	assert := require.New(t)
	cc0 := testCloudConfig{Key1: "k1v0", Key2: "k2v0"}
	cc1 := map[interface{}]interface{}{"key1": "k1value1", "hostname": "somehost"}
	Convert(cc1, &cc0)
	expected := testCloudConfig{Hostname: "somehost", Key1: "k1value1", Key2: "k2v0"}
	assert.Equal(expected, cc0)
}
Exemplo n.º 27
0
func TestPassByValue(t *testing.T) {
	assert := require.New(t)
	cc0ptr := &testCloudConfig{}
	cc0ptr.Hostname = "test0"
	cc1 := *cc0ptr
	cc1.Hostname = "test1"
	assert.NotEqual(cc0ptr.Hostname, cc1.Hostname)
}
Exemplo n.º 28
0
func TestListCmd(t *testing.T) {
	require := require.New(t)
	cmd := listCmd()

	require.NotNil(cmd)
	require.Equal("list", cmd.Name())
	require.NotNil(cmd.RunE)
}
Exemplo n.º 29
0
func Test_Columns_WriteableString_Symbolized(t *testing.T) {
	r := require.New(t)
	for _, f := range []interface{}{foo{}, &foo{}} {
		c := columns.ColumnsForStruct(f, "foo")
		u := c.Writeable().SymbolizedString()
		r.Equal(u, ":LastName, :write")
	}
}
Exemplo n.º 30
0
func Test_Columns_UpdateString(t *testing.T) {
	r := require.New(t)
	for _, f := range []interface{}{foo{}, &foo{}} {
		c := columns.ColumnsForStruct(f, "foo")
		u := c.Writeable().UpdateString()
		r.Equal(u, "LastName = :LastName, write = :write")
	}
}