Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
fabric-sdk-go
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
刘星星@五瓣科技
fabric-sdk-go
Commits
1317fba5
Commit
1317fba5
authored
Feb 29, 2020
by
刘星星@五瓣科技
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
modify autu test
parent
015d159a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
126 additions
and
74 deletions
+126
-74
workspace.xml
.idea/workspace.xml
+8
-12
gxhauth_test.go
fabric-sdk-test/gxhauth_test.go
+118
-62
No files found.
.idea/workspace.xml
View file @
1317fba5
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-8"?>
<project
version=
"4"
>
<project
version=
"4"
>
<component
name=
"ChangeListManager"
>
<component
name=
"ChangeListManager"
>
<list
default=
"true"
id=
"ee3cbcfc-22a8-483f-ab70-61744bc6fcb7"
name=
"Default Changelist"
comment=
""
>
<list
default=
"true"
id=
"ee3cbcfc-22a8-483f-ab70-61744bc6fcb7"
name=
"Default Changelist"
comment=
""
/>
<change
afterPath=
"$PROJECT_DIR$/fabric-sdk-test/gxhauth_test.go"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/.idea/workspace.xml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/.idea/workspace.xml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/fabric-sdk-go/test/fixtures/config/config_e2e.yaml"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/fabric-sdk-go/test/fixtures/config/config_e2e.yaml"
afterDir=
"false"
/>
<change
beforePath=
"$PROJECT_DIR$/fabric-sdk-go/test/integration/e2e/ccprovider_test.go"
beforeDir=
"false"
afterPath=
"$PROJECT_DIR$/fabric-sdk-go/test/integration/e2e/ccprovider_test.go"
afterDir=
"false"
/>
</list>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"EXCLUDED_CONVERTED_TO_IGNORED"
value=
"true"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"SHOW_DIALOG"
value=
"false"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
<option
name=
"HIGHLIGHT_CONFLICTS"
value=
"true"
/>
...
@@ -44,8 +39,8 @@
...
@@ -44,8 +39,8 @@
<file
pinned=
"false"
current-in-tab=
"true"
>
<file
pinned=
"false"
current-in-tab=
"true"
>
<entry
file=
"file://$PROJECT_DIR$/fabric-sdk-test/gxhauth_test.go"
>
<entry
file=
"file://$PROJECT_DIR$/fabric-sdk-test/gxhauth_test.go"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
179
3"
>
<state
relative-caret-position=
"
531
3"
>
<caret
line=
"3
11"
column=
"68"
selection-start-line=
"311"
selection-start-column=
"62"
selection-end-line=
"311"
selection-end-column=
"68
"
/>
<caret
line=
"3
63"
column=
"5"
lean-forward=
"true"
selection-start-line=
"363"
selection-start-column=
"5"
selection-end-line=
"363"
selection-end-column=
"5
"
/>
<folding>
<folding>
<element
signature=
"e#20#48#0"
expanded=
"true"
/>
<element
signature=
"e#20#48#0"
expanded=
"true"
/>
</folding>
</folding>
...
@@ -427,13 +422,14 @@
...
@@ -427,13 +422,14 @@
</component>
</component>
<component
name=
"ToolWindowManager"
>
<component
name=
"ToolWindowManager"
>
<frame
x=
"71"
y=
"32"
width=
"2489"
height=
"1568"
extended-state=
"6"
/>
<frame
x=
"71"
y=
"32"
width=
"2489"
height=
"1568"
extended-state=
"6"
/>
<editor
active=
"true"
/>
<layout>
<layout>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.1712413"
/>
<window_info
content_ui=
"combo"
id=
"Project"
order=
"0"
visible=
"true"
weight=
"0.1712413"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"Structure"
order=
"1"
side_tool=
"true"
weight=
"0.25"
/>
<window_info
id=
"Favorites"
order=
"2"
side_tool=
"true"
/>
<window_info
id=
"Favorites"
order=
"2"
side_tool=
"true"
/>
<window_info
anchor=
"bottom"
id=
"Message"
order=
"0"
/>
<window_info
anchor=
"bottom"
id=
"Message"
order=
"0"
/>
<window_info
anchor=
"bottom"
id=
"Find"
order=
"1"
weight=
"0.32955974"
/>
<window_info
anchor=
"bottom"
id=
"Find"
order=
"1"
weight=
"0.32955974"
/>
<window_info
a
ctive=
"true"
anchor=
"bottom"
id=
"Run"
order=
"2"
visible=
"true
"
weight=
"0.32892907"
/>
<window_info
a
nchor=
"bottom"
id=
"Run"
order=
"2
"
weight=
"0.32892907"
/>
<window_info
anchor=
"bottom"
id=
"Debug"
order=
"3"
weight=
"0.4"
/>
<window_info
anchor=
"bottom"
id=
"Debug"
order=
"3"
weight=
"0.4"
/>
<window_info
anchor=
"bottom"
id=
"Cvs"
order=
"4"
weight=
"0.25"
/>
<window_info
anchor=
"bottom"
id=
"Cvs"
order=
"4"
weight=
"0.25"
/>
<window_info
anchor=
"bottom"
id=
"Inspection"
order=
"5"
weight=
"0.4"
/>
<window_info
anchor=
"bottom"
id=
"Inspection"
order=
"5"
weight=
"0.4"
/>
...
@@ -442,7 +438,7 @@
...
@@ -442,7 +438,7 @@
<window_info
anchor=
"bottom"
id=
"Version Control"
order=
"8"
/>
<window_info
anchor=
"bottom"
id=
"Version Control"
order=
"8"
/>
<window_info
anchor=
"bottom"
id=
"Database Changes"
order=
"9"
/>
<window_info
anchor=
"bottom"
id=
"Database Changes"
order=
"9"
/>
<window_info
anchor=
"bottom"
id=
"Statistic"
order=
"10"
/>
<window_info
anchor=
"bottom"
id=
"Statistic"
order=
"10"
/>
<window_info
a
nchor=
"bottom"
id=
"Terminal"
order=
"11
"
weight=
"0.32892907"
/>
<window_info
a
ctive=
"true"
anchor=
"bottom"
id=
"Terminal"
order=
"11"
visible=
"true
"
weight=
"0.32892907"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"12"
side_tool=
"true"
/>
<window_info
anchor=
"bottom"
id=
"Event Log"
order=
"12"
side_tool=
"true"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
<window_info
anchor=
"right"
id=
"Commander"
internal_type=
"SLIDING"
order=
"0"
type=
"SLIDING"
weight=
"0.4"
/>
<window_info
anchor=
"right"
id=
"Ant Build"
order=
"1"
weight=
"0.25"
/>
<window_info
anchor=
"right"
id=
"Ant Build"
order=
"1"
weight=
"0.25"
/>
...
@@ -824,8 +820,8 @@
...
@@ -824,8 +820,8 @@
</entry>
</entry>
<entry
file=
"file://$PROJECT_DIR$/fabric-sdk-test/gxhauth_test.go"
>
<entry
file=
"file://$PROJECT_DIR$/fabric-sdk-test/gxhauth_test.go"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<provider
selected=
"true"
editor-type-id=
"text-editor"
>
<state
relative-caret-position=
"
179
3"
>
<state
relative-caret-position=
"
531
3"
>
<caret
line=
"3
11"
column=
"68"
selection-start-line=
"311"
selection-start-column=
"62"
selection-end-line=
"311"
selection-end-column=
"68
"
/>
<caret
line=
"3
63"
column=
"5"
lean-forward=
"true"
selection-start-line=
"363"
selection-start-column=
"5"
selection-end-line=
"363"
selection-end-column=
"5
"
/>
<folding>
<folding>
<element
signature=
"e#20#48#0"
expanded=
"true"
/>
<element
signature=
"e#20#48#0"
expanded=
"true"
/>
</folding>
</folding>
...
...
fabric-sdk-test/gxhauth_test.go
View file @
1317fba5
...
@@ -11,16 +11,21 @@ import (
...
@@ -11,16 +11,21 @@ import (
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["User1@org2.example.com"],"Write":["Admin@org2.example.com"],"SchemaWrite":["Admin@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":0}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":0}}}}
`
`
// authInput = `{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["admin"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
//{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
//{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
//"id":{"Value":"1","Read":[],"Write":[]}},"Read":[],"Write":["user"]}
//`
inputUpdate
=
`{"id":"1","aname":"alibusi","atype":"newtype","alinkman":"newalinkman",
inputUpdate
=
`{"id":"1","aname":"alibusi","atype":"newtype","alinkman":"newalinkman",
"amob":"new1234567890","backup":{"aname":"alibusi","atype":"type"}}`
"amob":"new1234567890","backup":{"aname":"alibusi","atype":"type"}}`
...
@@ -28,11 +33,12 @@ var (
...
@@ -28,11 +33,12 @@ var (
inputarrary
=
`[{"id":"1","aname":"alibusi","atype":"type","alinkman":"alinkman",
inputarrary
=
`[{"id":"1","aname":"alibusi","atype":"type","alinkman":"alinkman",
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}},{"id":"2","aname":"alibusi","atype":"type","alinkman":"alinkman",
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}},{"id":"2","aname":"alibusi","atype":"type","alinkman":"alinkman",
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}}]`
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}}]`
ccId
=
"mycc"
)
)
func
TestSchemaPutAuth
(
t
*
testing
.
T
){
func
TestSchemaPutAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
"alibusi3
"
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
"alibusii
"
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -41,7 +47,7 @@ func TestSchemaPutAuth(t *testing.T){
...
@@ -41,7 +47,7 @@ func TestSchemaPutAuth(t *testing.T){
}
}
func
TestSchemaGetAuth
(
t
*
testing
.
T
){
func
TestSchemaGetAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
"alibusi3
"
)})
resSchema
,
errSchema
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
"alibusii
"
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcQuery execute err: "
,
errSchema
)
fmt
.
Println
(
"CcQuery execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -53,7 +59,7 @@ func TestSchemaGetAuth(t *testing.T){
...
@@ -53,7 +59,7 @@ func TestSchemaGetAuth(t *testing.T){
update Schema 只对新数据格式是否符合map[string]interface{} 的格式,以及更新的数据是否存在
update Schema 只对新数据格式是否符合map[string]interface{} 的格式,以及更新的数据是否存在
*/
*/
func
TestSchemaUpdateAuth
(
t
*
testing
.
T
){
func
TestSchemaUpdateAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
"alibusi3
"
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
"alibusii
"
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -64,7 +70,7 @@ func TestSchemaUpdateAuth(t *testing.T){
...
@@ -64,7 +70,7 @@ func TestSchemaUpdateAuth(t *testing.T){
----------------------------------------------------------Data Operation------------------------------------------------------------
----------------------------------------------------------Data Operation------------------------------------------------------------
*/
*/
func
TestDataPutAuth
(
t
*
testing
.
T
){
func
TestDataPutAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"put"
,[][]
byte
{[]
byte
(
"alibusi3
"
),[]
byte
(
inputarrary
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"put"
,[][]
byte
{[]
byte
(
"alibusii
"
),[]
byte
(
inputarrary
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -73,7 +79,7 @@ func TestDataPutAuth(t *testing.T){
...
@@ -73,7 +79,7 @@ func TestDataPutAuth(t *testing.T){
}
}
func
TestDataGetAuth
(
t
*
testing
.
T
){
func
TestDataGetAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcQuery
(
"gongxianghui_auth"
,
"get"
,[][]
byte
{[]
byte
(
"alibusi3
"
),[]
byte
(
`{"id":"1"}`
)})
resSchema
,
errSchema
:=
CcQuery
(
ccId
,
"get"
,[][]
byte
{[]
byte
(
"alibusii
"
),[]
byte
(
`{"id":"1"}`
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcQuery execute err: "
,
errSchema
)
fmt
.
Println
(
"CcQuery execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -82,7 +88,7 @@ func TestDataGetAuth(t *testing.T){
...
@@ -82,7 +88,7 @@ func TestDataGetAuth(t *testing.T){
}
}
func
TestDataUpdateAuth
(
t
*
testing
.
T
){
func
TestDataUpdateAuth
(
t
*
testing
.
T
){
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"update"
,[][]
byte
{[]
byte
(
"alibusi3
"
),[]
byte
(
inputUpdate
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"update"
,[][]
byte
{[]
byte
(
"alibusii
"
),[]
byte
(
inputUpdate
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
fmt
.
Println
(
"CcInvoke execute err: "
,
errSchema
)
}
else
{
}
else
{
...
@@ -96,12 +102,22 @@ func TestDataUpdateAuth(t *testing.T){
...
@@ -96,12 +102,22 @@ func TestDataUpdateAuth(t *testing.T){
当数据全部正确时的测试数据,当前用户为Admin@org2.example.com
当数据全部正确时的测试数据,当前用户为Admin@org2.example.com
*/
*/
func
TestAuthRight
(
t
*
testing
.
T
){
func
TestAuthRight
(
t
*
testing
.
T
){
taleName
:=
"alibusi
5
"
//我们在每次测试的时候需要保证我们的table name 不重复
taleName
:=
"alibusi
Right
"
//我们在每次测试的时候需要保证我们的table name 不重复
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["Admin@org2.example.com"],"Write":["Admin@org2.example.com"],"SchemaWrite":["Admin@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":0}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":0}}}}
`
`
inputUpdate
=
`{"id":"1","aname":"alibusi","atype":"newtype","alinkman":"newalinkman",
inputUpdate
=
`{"id":"1","aname":"alibusi","atype":"newtype","alinkman":"newalinkman",
...
@@ -113,7 +129,7 @@ func TestAuthRight(t *testing.T){
...
@@ -113,7 +129,7 @@ func TestAuthRight(t *testing.T){
)
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -122,7 +138,7 @@ func TestAuthRight(t *testing.T){
...
@@ -122,7 +138,7 @@ func TestAuthRight(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaget
,
errSchemaget
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
resSchemaget
,
errSchemaget
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
if
errSchemaget
!=
nil
{
if
errSchemaget
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
}
else
{
}
else
{
...
@@ -131,7 +147,7 @@ func TestAuthRight(t *testing.T){
...
@@ -131,7 +147,7 @@ func TestAuthRight(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaup
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchemaup
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -140,7 +156,7 @@ func TestAuthRight(t *testing.T){
...
@@ -140,7 +156,7 @@ func TestAuthRight(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resData
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
resData
,
errData
:=
CcInvoke
(
ccId
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -149,7 +165,7 @@ func TestAuthRight(t *testing.T){
...
@@ -149,7 +165,7 @@ func TestAuthRight(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get data======================================================"
)
fmt
.
Println
(
"=============================================get data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resDataget
,
errSchema
:=
CcQuery
(
"gongxianghui_auth"
,
"get"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
`{"id":"1"}`
)})
resDataget
,
errSchema
:=
CcQuery
(
ccId
,
"get"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
`{"id":"1"}`
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -158,7 +174,7 @@ func TestAuthRight(t *testing.T){
...
@@ -158,7 +174,7 @@ func TestAuthRight(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================update data======================================================"
)
fmt
.
Println
(
"=============================================update data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resDataup
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"update"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputUpdate
)})
resDataup
,
errSchema
:=
CcInvoke
(
ccId
,
"update"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputUpdate
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -170,18 +186,28 @@ func TestAuthRight(t *testing.T){
...
@@ -170,18 +186,28 @@ func TestAuthRight(t *testing.T){
主要测试schema Update时的权限测试,当前用户为Admin@org2.example.com
主要测试schema Update时的权限测试,当前用户为Admin@org2.example.com
*/
*/
func
TestAuthSchemaWrite
(
t
*
testing
.
T
){
func
TestAuthSchemaWrite
(
t
*
testing
.
T
){
taleName
:=
"alibusi
6
"
//我们在每次测试的时候需要保证我们的table name 不重复
taleName
:=
"alibusi
SUp
"
//我们在每次测试的时候需要保证我们的table name 不重复
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["Admin@org2.example.com"],"Write":["Admin@org2.example.com"],"SchemaWrite":["User1@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":0}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":0}}}}
`
`
)
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -190,7 +216,7 @@ func TestAuthSchemaWrite(t *testing.T){
...
@@ -190,7 +216,7 @@ func TestAuthSchemaWrite(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaget
,
errSchemaget
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
resSchemaget
,
errSchemaget
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
if
errSchemaget
!=
nil
{
if
errSchemaget
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
}
else
{
}
else
{
...
@@ -199,7 +225,7 @@ func TestAuthSchemaWrite(t *testing.T){
...
@@ -199,7 +225,7 @@ func TestAuthSchemaWrite(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaup
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchemaup
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -211,12 +237,22 @@ func TestAuthSchemaWrite(t *testing.T){
...
@@ -211,12 +237,22 @@ func TestAuthSchemaWrite(t *testing.T){
主要测试Data put时的权限测试,当前用户为Admin@org2.example.com
主要测试Data put时的权限测试,当前用户为Admin@org2.example.com
*/
*/
func
TestAuthDataPut
(
t
*
testing
.
T
){
func
TestAuthDataPut
(
t
*
testing
.
T
){
taleName
:=
"alibusi
7
"
//我们在每次测试的时候需要保证我们的table name 不重复
taleName
:=
"alibusi
DataPut
"
//我们在每次测试的时候需要保证我们的table name 不重复
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["Admin@org2.example.com"],"Write":["User1@org2.example.com"],"SchemaWrite":["User1@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":0}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"User1@org2.example.com":0}}}}
`
`
inputarrary
=
`[{"id":"1","aname":"alibusi","atype":"type","alinkman":"alinkman",
inputarrary
=
`[{"id":"1","aname":"alibusi","atype":"type","alinkman":"alinkman",
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}},{"id":"2","aname":"alibusi","atype":"type","alinkman":"alinkman",
"amob":"1234567890","backup":{"aname":"alibusi","atype":"type"}},{"id":"2","aname":"alibusi","atype":"type","alinkman":"alinkman",
...
@@ -224,7 +260,7 @@ func TestAuthDataPut(t *testing.T){
...
@@ -224,7 +260,7 @@ func TestAuthDataPut(t *testing.T){
)
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -233,7 +269,7 @@ func TestAuthDataPut(t *testing.T){
...
@@ -233,7 +269,7 @@ func TestAuthDataPut(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaget
,
errSchemaget
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
resSchemaget
,
errSchemaget
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
if
errSchemaget
!=
nil
{
if
errSchemaget
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
}
else
{
}
else
{
...
@@ -242,7 +278,7 @@ func TestAuthDataPut(t *testing.T){
...
@@ -242,7 +278,7 @@ func TestAuthDataPut(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resData
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
resData
,
errData
:=
CcInvoke
(
ccId
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
}
else
{
}
else
{
...
@@ -254,12 +290,22 @@ func TestAuthDataPut(t *testing.T){
...
@@ -254,12 +290,22 @@ func TestAuthDataPut(t *testing.T){
主要测试Data Update时的权限测试,主要测试字段的权限控制,当前用户为Admin@org2.example.com
主要测试Data Update时的权限测试,主要测试字段的权限控制,当前用户为Admin@org2.example.com
*/
*/
func
TestAuthDataUpdate
(
t
*
testing
.
T
){
func
TestAuthDataUpdate
(
t
*
testing
.
T
){
taleName
:=
"alibusi
8
"
//我们在每次测试的时候需要保证我们的table name 不重复
taleName
:=
"alibusi
DataUp1
"
//我们在每次测试的时候需要保证我们的table name 不重复
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["admin"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["Admin@org2.example.com"],"Write":["Admin@org2.example.com"],"SchemaWrite":["Admin@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":0}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":0}}}}
`
`
authInputUp
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInputUp
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
...
@@ -275,7 +321,7 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -275,7 +321,7 @@ func TestAuthDataUpdate(t *testing.T){
)
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -284,7 +330,7 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -284,7 +330,7 @@ func TestAuthDataUpdate(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaget
,
errSchemaget
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
resSchemaget
,
errSchemaget
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
if
errSchemaget
!=
nil
{
if
errSchemaget
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
}
else
{
}
else
{
...
@@ -293,7 +339,7 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -293,7 +339,7 @@ func TestAuthDataUpdate(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resData
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
resData
,
errData
:=
CcInvoke
(
ccId
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
}
else
{
}
else
{
...
@@ -302,7 +348,7 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -302,7 +348,7 @@ func TestAuthDataUpdate(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
(
"=============================================update schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaup
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInputUp
)})
resSchemaup
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"update"
),[]
byte
(
taleName
),[]
byte
(
authInputUp
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -311,7 +357,7 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -311,7 +357,7 @@ func TestAuthDataUpdate(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================update data======================================================"
)
fmt
.
Println
(
"=============================================update data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resDataUp
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"update"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputUpdate
)})
resDataUp
,
errData
:=
CcInvoke
(
ccId
,
"update"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputUpdate
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
}
else
{
}
else
{
...
@@ -320,15 +366,25 @@ func TestAuthDataUpdate(t *testing.T){
...
@@ -320,15 +366,25 @@ func TestAuthDataUpdate(t *testing.T){
}
}
/*
/*
主要测试Data get时的权限测试,主要测试字段的权限控制,当前用户为Admin@org2.example.com
*/
*/
func
TestAuthDataGet
(
t
*
testing
.
T
){
func
TestAuthDataGet
(
t
*
testing
.
T
){
taleName
:=
"alibusi
11
"
//我们在每次测试的时候需要保证我们的table name 不重复
taleName
:=
"alibusi
DataGet
"
//我们在每次测试的时候需要保证我们的table name 不重复
var
(
var
(
authInput
=
`{"Parameters":{"alinkman":{"Value":"Alinkman","Read":["user"],"Write":["admin"]},"amob":{"Value":"Amob","Read":[],"Write":[]},"aname":
authInput
=
`{"fields":{"alinkman":{"val":"Alinkman","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]},"backup":{"Value":{"aname":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
{"Value":"Aname","Read":["admin"],"Write":["admin"]},"atype":{"Value":"Atype","Read":["admin"],"Write":["admin"]}},"Read":["Admin@org2.example.com"],"Write":["admin"]},
"amob":{"val":"Amob","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":
"id":{"Value":"1","Read":[],"Write":[]}},"Read":["User1@org2.example.com"],"Write":["Admin@org2.example.com"],"SchemaWrite":["User1@org2.example.com"]}
{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},"aname":{"val":"Aname","auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}}}},"atype":{"val":"Atype","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"backup":{"val":{"aname":"Aname","atype":"Atype"},"auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}},
"id":{"val":"1","auth":{"read":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}}}},"schema_auth":{"read":{"users":null,"roles":null},
"write":{"users":{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}}},"auth":{"read":{"users":
{"Admin@org2.example.com":0},"roles":{"Admin@org2.example.com":1582988515}},"write":{"users":{"Admin@org2.example.com":0},"roles":
{"Admin@org2.example.com":0}}}}
`
`
inputget
=
`{"id":"1"}`
inputget
=
`{"id":"1"}`
...
@@ -338,7 +394,7 @@ func TestAuthDataGet(t *testing.T){
...
@@ -338,7 +394,7 @@ func TestAuthDataGet(t *testing.T){
)
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
fmt
.
Println
(
"=============================================put schema======================================================"
)
resSchema
,
errSchema
:=
CcInvoke
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
resSchema
,
errSchema
:=
CcInvoke
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"put"
),[]
byte
(
taleName
),[]
byte
(
authInput
)})
if
errSchema
!=
nil
{
if
errSchema
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errSchema
)
}
else
{
}
else
{
...
@@ -347,7 +403,7 @@ func TestAuthDataGet(t *testing.T){
...
@@ -347,7 +403,7 @@ func TestAuthDataGet(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
(
"=============================================get schema======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resSchemaget
,
errSchemaget
:=
CcQuery
(
"gongxianghui_auth"
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
resSchemaget
,
errSchemaget
:=
CcQuery
(
ccId
,
"schema"
,[][]
byte
{[]
byte
(
"get"
),[]
byte
(
taleName
)})
if
errSchemaget
!=
nil
{
if
errSchemaget
!=
nil
{
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
t
.
Errorf
(
"CcQuery execute err : %s"
,
errSchemaget
)
}
else
{
}
else
{
...
@@ -356,7 +412,7 @@ func TestAuthDataGet(t *testing.T){
...
@@ -356,7 +412,7 @@ func TestAuthDataGet(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
(
"=============================================put data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resData
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
resData
,
errData
:=
CcInvoke
(
ccId
,
"put"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputarrary
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
}
else
{
}
else
{
...
@@ -367,7 +423,7 @@ func TestAuthDataGet(t *testing.T){
...
@@ -367,7 +423,7 @@ func TestAuthDataGet(t *testing.T){
fmt
.
Println
()
fmt
.
Println
()
fmt
.
Println
(
"=============================================get data======================================================"
)
fmt
.
Println
(
"=============================================get data======================================================"
)
fmt
.
Println
()
fmt
.
Println
()
resDataget
,
errData
:=
CcInvoke
(
"gongxianghui_auth"
,
"get"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputget
)})
resDataget
,
errData
:=
CcInvoke
(
ccId
,
"get"
,[][]
byte
{[]
byte
(
taleName
),[]
byte
(
inputget
)})
if
errData
!=
nil
{
if
errData
!=
nil
{
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
t
.
Errorf
(
"CcInvoke execute err : %s"
,
errData
)
}
else
{
}
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment