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
cd5843e9
Commit
cd5843e9
authored
Jan 16, 2015
by
Torkel Ödegaard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed unit tests
parent
04bbdbad
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
12 deletions
+12
-12
pkg/services/sqlstore/accounts_test.go
+10
-10
pkg/services/sqlstore/tokens.go
+2
-2
No files found.
pkg/services/sqlstore/accounts_test.go
View file @
cd5843e9
...
@@ -30,6 +30,16 @@ func TestAccountDataAccess(t *testing.T) {
...
@@ -30,6 +30,16 @@ func TestAccountDataAccess(t *testing.T) {
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
So
(
query
.
Result
.
Email
,
ShouldEqual
,
"ac1@test.com"
)
So
(
query
.
Result
.
Email
,
ShouldEqual
,
"ac1@test.com"
)
So
(
query
.
Result
.
Login
,
ShouldEqual
,
"ac1"
)
})
Convey
(
"Can search accounts"
,
func
()
{
query
:=
m
.
SearchAccountsQuery
{
Query
:
""
}
err
:=
SearchAccounts
(
&
query
)
So
(
err
,
ShouldBeNil
)
So
(
query
.
Result
[
0
]
.
Email
,
ShouldEqual
,
"ac1@test.com"
)
So
(
query
.
Result
[
1
]
.
Email
,
ShouldEqual
,
"ac2@test.com"
)
})
})
Convey
(
"Can add collaborator"
,
func
()
{
Convey
(
"Can add collaborator"
,
func
()
{
...
@@ -44,16 +54,6 @@ func TestAccountDataAccess(t *testing.T) {
...
@@ -44,16 +54,6 @@ func TestAccountDataAccess(t *testing.T) {
So
(
err
,
ShouldBeNil
)
So
(
err
,
ShouldBeNil
)
})
})
Convey
(
"Collaborator should be included in account info projection"
,
func
()
{
query
:=
m
.
GetAccountInfoQuery
{
Id
:
ac1
.
Id
}
err
=
GetAccountInfo
(
&
query
)
So
(
err
,
ShouldBeNil
)
So
(
query
.
Result
.
Collaborators
[
0
]
.
CollaboratorId
,
ShouldEqual
,
ac2
.
Id
)
So
(
query
.
Result
.
Collaborators
[
0
]
.
Role
,
ShouldEqual
,
m
.
ROLE_READ_WRITE
)
So
(
query
.
Result
.
Collaborators
[
0
]
.
Email
,
ShouldEqual
,
"ac2@test.com"
)
})
Convey
(
"Can get other accounts"
,
func
()
{
Convey
(
"Can get other accounts"
,
func
()
{
query
:=
m
.
GetOtherAccountsQuery
{
AccountId
:
ac2
.
Id
}
query
:=
m
.
GetOtherAccountsQuery
{
AccountId
:
ac2
.
Id
}
err
:=
GetOtherAccounts
(
&
query
)
err
:=
GetOtherAccounts
(
&
query
)
...
...
pkg/services/sqlstore/tokens.go
View file @
cd5843e9
package
sqlstore
package
sqlstore
import
(
import
(
"time"
"github.com/go-xorm/xorm"
"github.com/go-xorm/xorm"
"github.com/torkelo/grafana-pro/pkg/bus"
"github.com/torkelo/grafana-pro/pkg/bus"
m
"github.com/torkelo/grafana-pro/pkg/models"
m
"github.com/torkelo/grafana-pro/pkg/models"
"time"
)
)
func
init
()
{
func
init
()
{
...
@@ -30,7 +31,6 @@ func DeleteToken(cmd *m.DeleteTokenCommand) error {
...
@@ -30,7 +31,6 @@ func DeleteToken(cmd *m.DeleteTokenCommand) error {
}
}
func
AddToken
(
cmd
*
m
.
AddTokenCommand
)
error
{
func
AddToken
(
cmd
*
m
.
AddTokenCommand
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
return
inTransaction
(
func
(
sess
*
xorm
.
Session
)
error
{
t
:=
m
.
Token
{
t
:=
m
.
Token
{
AccountId
:
cmd
.
AccountId
,
AccountId
:
cmd
.
AccountId
,
...
...
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