fix(build): fixed failing unit test

This commit is contained in:
Torkel Ödegaard 2016-10-01 17:36:56 +02:00
parent 4ec2377e09
commit 4a116ad4ad
2 changed files with 8 additions and 4 deletions

View File

@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
func AddDataSource(cmd *m.AddDataSourceCommand) error {
return inTransaction(func(sess *xorm.Session) error {
existing := m.DataSource{OrgId: cmd.OrgId, Name: cmd.Name}
has, _ := x.Get(&existing)
has, _ := sess.Get(&existing)
if has {
return m.ErrDataSourceNameExists

View File

@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) {
err := AddDataSource(&m.AddDataSourceCommand{
OrgId: 10,
Name: "laban",
Type: m.DS_INFLUXDB,
Access: m.DS_ACCESS_DIRECT,
Url: "http://test",
@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) {
Convey("Given a datasource", func() {
AddDataSource(&m.AddDataSourceCommand{
err := AddDataSource(&m.AddDataSourceCommand{
OrgId: 10,
Name: "nisse",
Type: m.DS_GRAPHITE,
Access: m.DS_ACCESS_DIRECT,
Url: "http://test",
})
So(err, ShouldBeNil)
query := m.GetDataSourcesQuery{OrgId: 10}
GetDataSources(&query)
err = GetDataSources(&query)
So(err, ShouldBeNil)
ds := query.Result[0]
Convey("Can delete datasource", func() {