Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
burrow
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hang Yu
burrow
Commits
2c769a8d
Commit
2c769a8d
authored
9 years ago
by
androlo
Browse files
Options
Downloads
Patches
Plain Diff
Updated filter tests as well
parent
97f190c1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
test/testdata/filters/testdata_filters.go
+38
-42
38 additions, 42 deletions
test/testdata/filters/testdata_filters.go
test/web_api/query_test.go
+6
-6
6 additions, 6 deletions
test/web_api/query_test.go
with
44 additions
and
48 deletions
test/testdata/filters/testdata_filters.go
+
38
−
42
View file @
2c769a8d
package
filters
import
(
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/state"
edb
"github.com/eris-ltd/eris-db/erisdb"
ep
"github.com/eris-ltd/eris-db/erisdb/pipe"
"github.com/eris-ltd/eris-db/Godeps/_workspace/src/github.com/tendermint/tendermint/state"
)
var
testDataJson
=
`{
...
...
@@ -98,36 +98,15 @@ var testDataJson = `{
]
}
},
"
input
": {
"
filters0
": [
"
GetAccounts0
": {
"
input
": [
{
"field": "balance",
"op": "==",
"value": "0"
}
],
"filters1": [
{
"field": "balance",
"op": ">",
"value": "12"
}
],
"filters2": [
{
"field": "balance",
"op": ">=",
"value": "5"
},
{
"field": "balance",
"op": "<",
"value": "8"
}
]
},
"output": {
"accounts0": {
"output": {
"accounts": [
{
"address": "1000000000000000000000000000000000000000",
...
...
@@ -145,8 +124,17 @@ var testDataJson = `{
}
}
]
},
"accounts1": {
}
},
"GetAccounts1": {
"input": [
{
"field": "balance",
"op": ">",
"value": "12"
}
],
"output": {
"accounts": [
{
"address": "0000000000000000000000000000000000000000",
...
...
@@ -209,8 +197,22 @@ var testDataJson = `{
}
}
]
},
"accounts2": {
}
},
"GetAccounts2": {
"input": [
{
"field": "balance",
"op": ">=",
"value": "5"
},
{
"field": "balance",
"op": "<",
"value": "8"
}
],
"output": {
"accounts": [
{
"address": "0000000000000000000000000000000000000005",
...
...
@@ -270,22 +272,16 @@ type (
Genesis
*
state
.
GenesisDoc
`json:"genesis"`
}
Input
struct
{
Filters0
[]
*
ep
.
FilterData
`json:"filters0"`
Filters1
[]
*
ep
.
FilterData
`json:"filters1"`
Filters2
[]
*
ep
.
FilterData
`json:"filters2"`
}
Output
struct
{
Accounts0
*
ep
.
AccountList
`json:"accounts0"`
Accounts1
*
ep
.
AccountList
`json:"accounts1"`
Accounts2
*
ep
.
AccountList
`json:"accounts2"`
GetAccountData
struct
{
Input
[]
*
ep
.
FilterData
`json:"input"`
Output
*
ep
.
AccountList
`json:"output"`
}
TestData
struct
{
ChainData
*
ChainData
`json:"chain_data"`
Input
*
Input
`json:"input"`
Output
*
Output
`json:"output"`
ChainData
*
ChainData
`json:"chain_data"`
GetAccounts0
*
GetAccountData
GetAccounts1
*
GetAccountData
GetAccounts2
*
GetAccountData
}
)
...
...
This diff is collapsed.
Click to expand it.
test/web_api/query_test.go
+
6
−
6
View file @
2c769a8d
...
...
@@ -73,30 +73,30 @@ func (this *QuerySuite) TearDownSuite() {
// TODO less duplication.
func
(
this
*
QuerySuite
)
Test_Accounts0
()
{
fd
:=
this
.
testData
.
Input
.
Filters0
fd
:=
this
.
testData
.
GetAccounts0
.
Input
resp
:=
this
.
get
(
"/accounts?"
+
generateQuery
(
fd
))
ret
:=
&
ep
.
AccountList
{}
errD
:=
this
.
codec
.
Decode
(
ret
,
resp
.
Body
)
this
.
NoError
(
errD
)
this
.
Equal
(
this
.
testData
.
Output
.
Accounts0
,
ret
)
this
.
Equal
(
this
.
testData
.
Get
Accounts0
.
Output
,
ret
)
}
func
(
this
*
QuerySuite
)
Test_Accounts1
()
{
fd
:=
this
.
testData
.
Input
.
Filters1
fd
:=
this
.
testData
.
GetAccounts1
.
Input
resp
:=
this
.
get
(
"/accounts?"
+
generateQuery
(
fd
))
ret
:=
&
ep
.
AccountList
{}
errD
:=
this
.
codec
.
Decode
(
ret
,
resp
.
Body
)
this
.
NoError
(
errD
)
this
.
Equal
(
this
.
testData
.
Output
.
Accounts1
,
ret
)
this
.
Equal
(
this
.
testData
.
Get
Accounts1
.
Output
,
ret
)
}
func
(
this
*
QuerySuite
)
Test_Accounts2
()
{
fd
:=
this
.
testData
.
Input
.
Filters2
fd
:=
this
.
testData
.
GetAccounts2
.
Input
resp
:=
this
.
get
(
"/accounts?"
+
generateQuery
(
fd
))
ret
:=
&
ep
.
AccountList
{}
errD
:=
this
.
codec
.
Decode
(
ret
,
resp
.
Body
)
this
.
NoError
(
errD
)
this
.
Equal
(
this
.
testData
.
Output
.
Accounts2
,
ret
)
this
.
Equal
(
this
.
testData
.
Get
Accounts2
.
Output
,
ret
)
}
// ********************************************* Utilities *********************************************
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment