Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nexpie-grafana-theme
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Registry
Registry
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kornkitt Poolsup
nexpie-grafana-theme
Commits
29ec0529
Commit
29ec0529
authored
Jun 15, 2017
by
Daniel Lee
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
WIP: add test for add user group permission
parent
0e853163
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
2 deletions
+32
-2
public/app/features/dashboard/acl/acl.ts
+1
-1
public/app/features/dashboard/acl/specs/acl_specs.ts
+31
-1
No files found.
public/app/features/dashboard/acl/acl.ts
View file @
29ec0529
...
@@ -51,7 +51,7 @@ export class AclCtrl {
...
@@ -51,7 +51,7 @@ export class AclCtrl {
return
;
return
;
}
}
this
.
addOrUpdateUserGroupPermission
(
this
.
userGroupId
,
this
.
permission
).
then
(()
=>
{
return
this
.
addOrUpdateUserGroupPermission
(
this
.
userGroupId
,
this
.
permission
).
then
(()
=>
{
this
.
userGroupId
=
null
;
this
.
userGroupId
=
null
;
return
this
.
get
(
this
.
dashboard
.
id
);
return
this
.
get
(
this
.
dashboard
.
id
);
});
});
...
...
public/app/features/dashboard/acl/specs/acl_specs.ts
View file @
29ec0529
...
@@ -25,6 +25,8 @@ describe('AclCtrl', () => {
...
@@ -25,6 +25,8 @@ describe('AclCtrl', () => {
describe
(
'when user permission is to be added'
,
()
=>
{
describe
(
'when user permission is to be added'
,
()
=>
{
beforeEach
(
done
=>
{
beforeEach
(
done
=>
{
backendSrv
.
get
.
reset
();
backendSrv
.
post
.
reset
();
ctx
.
ctrl
.
type
=
'User'
;
ctx
.
ctrl
.
type
=
'User'
;
ctx
.
ctrl
.
userId
=
2
;
ctx
.
ctrl
.
userId
=
2
;
ctx
.
ctrl
.
permission
=
1
;
ctx
.
ctrl
.
permission
=
1
;
...
@@ -41,11 +43,39 @@ describe('AclCtrl', () => {
...
@@ -41,11 +43,39 @@ describe('AclCtrl', () => {
});
});
it
(
'should refresh the list after saving.'
,
()
=>
{
it
(
'should refresh the list after saving.'
,
()
=>
{
expect
(
backendSrv
.
get
.
getCall
(
1
).
args
[
0
]).
to
.
eql
(
'/api/dashboards/1/acl'
);
expect
(
backendSrv
.
get
.
getCall
(
0
).
args
[
0
]).
to
.
eql
(
'/api/dashboards/1/acl'
);
});
});
it
(
'should reset userId'
,
()
=>
{
it
(
'should reset userId'
,
()
=>
{
expect
(
ctx
.
ctrl
.
userId
).
to
.
eql
(
null
);
expect
(
ctx
.
ctrl
.
userId
).
to
.
eql
(
null
);
});
});
});
});
describe
(
'when user group permission is to be added'
,
()
=>
{
beforeEach
(
done
=>
{
backendSrv
.
get
.
reset
();
backendSrv
.
post
.
reset
();
ctx
.
ctrl
.
type
=
'User Group'
;
ctx
.
ctrl
.
userGroupId
=
2
;
ctx
.
ctrl
.
permission
=
1
;
ctx
.
ctrl
.
addPermission
().
then
(()
=>
{
done
();
});
});
it
(
'should parse the result and save to db'
,
()
=>
{
expect
(
backendSrv
.
post
.
getCall
(
0
).
args
[
0
]).
to
.
eql
(
'/api/dashboards/1/acl'
);
expect
(
backendSrv
.
post
.
getCall
(
0
).
args
[
1
].
userGroupId
).
to
.
eql
(
2
);
expect
(
backendSrv
.
post
.
getCall
(
0
).
args
[
1
].
permissionType
).
to
.
eql
(
1
);
});
it
(
'should refresh the list after saving.'
,
()
=>
{
expect
(
backendSrv
.
get
.
getCall
(
0
).
args
[
0
]).
to
.
eql
(
'/api/dashboards/1/acl'
);
});
it
(
'should reset userGroupId'
,
()
=>
{
expect
(
ctx
.
ctrl
.
userGroupId
).
to
.
eql
(
null
);
});
});
});
});
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