-
Notifications
You must be signed in to change notification settings - Fork 10
/
core_params_test.go
33 lines (26 loc) · 800 Bytes
/
core_params_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package solr_test
import (
"testing"
"github.com/stretchr/testify/assert"
"github.com/stevenferrer/solr-go"
)
func TestBuildCoreParams(t *testing.T) {
got := solr.NewCoreParams("mycore").
DeleteIndex(true).
DeleteDataDir(true).
DeleteInstanceDir(true).
BuildParams()
expect := "core=mycore&deleteDataDir=true&deleteIndex=true&deleteInstanceDir=true"
assert.Equal(t, expect, got)
}
func TestBuildCreateCoreParams(t *testing.T) {
got := solr.NewCreateCoreParams("mycore").
InstanceDir("mycore").
Config("solrconfig.xml").
DataDir("my-data-dir").
ConfigSet("_default").
Schema("managed-schema").
BuildParams()
expect := "config=solrconfig.xml&configSet=_default&dataDir=my-data-dir&instanceDir=mycore&name=mycore&schema=managed-schema"
assert.Equal(t, expect, got)
}