feat(invite): worked on db & domain model for temp users, #2353

This commit is contained in:
Torkel Ödegaard
2015-07-16 17:59:11 +02:00
parent c3a5822a40
commit 444807c35b
5 changed files with 176 additions and 0 deletions
+36
View File
@@ -0,0 +1,36 @@
package sqlstore
import (
"testing"
. "github.com/smartystreets/goconvey/convey"
m "github.com/grafana/grafana/pkg/models"
)
func TestTempUserCommandsAndQueries(t *testing.T) {
Convey("Testing Temp User commands & queries", t, func() {
InitTestDB(t)
Convey("Given saved api key", func() {
cmd := m.CreateTempUserCommand{
OrgId: 2256,
Name: "hello",
Email: "e@as.co",
IsInvite: true,
}
err := CreateTempUser(&cmd)
So(err, ShouldBeNil)
Convey("Should be able to get temp users by org id", func() {
query := m.GetTempUsersForOrgQuery{OrgId: 2256}
err = GetTempUsersForOrg(&query)
So(err, ShouldBeNil)
So(len(query.Result), ShouldEqual, 1)
})
})
})
}