Commit 4a116ad4 by Torkel Ödegaard

fix(build): fixed failing unit test

parent 4ec2377e
...@@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error { ...@@ -60,9 +60,8 @@ func DeleteDataSource(cmd *m.DeleteDataSourceCommand) error {
func AddDataSource(cmd *m.AddDataSourceCommand) error { func AddDataSource(cmd *m.AddDataSourceCommand) error {
return inTransaction(func(sess *xorm.Session) error { return inTransaction(func(sess *xorm.Session) error {
existing := m.DataSource{OrgId: cmd.OrgId, Name: cmd.Name} existing := m.DataSource{OrgId: cmd.OrgId, Name: cmd.Name}
has, _ := x.Get(&existing) has, _ := sess.Get(&existing)
if has { if has {
return m.ErrDataSourceNameExists return m.ErrDataSourceNameExists
......
...@@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) { ...@@ -41,6 +41,7 @@ func TestDataAccess(t *testing.T) {
err := AddDataSource(&m.AddDataSourceCommand{ err := AddDataSource(&m.AddDataSourceCommand{
OrgId: 10, OrgId: 10,
Name: "laban",
Type: m.DS_INFLUXDB, Type: m.DS_INFLUXDB,
Access: m.DS_ACCESS_DIRECT, Access: m.DS_ACCESS_DIRECT,
Url: "http://test", Url: "http://test",
...@@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) { ...@@ -63,15 +64,19 @@ func TestDataAccess(t *testing.T) {
Convey("Given a datasource", func() { Convey("Given a datasource", func() {
AddDataSource(&m.AddDataSourceCommand{ err := AddDataSource(&m.AddDataSourceCommand{
OrgId: 10, OrgId: 10,
Name: "nisse",
Type: m.DS_GRAPHITE, Type: m.DS_GRAPHITE,
Access: m.DS_ACCESS_DIRECT, Access: m.DS_ACCESS_DIRECT,
Url: "http://test", Url: "http://test",
}) })
So(err, ShouldBeNil)
query := m.GetDataSourcesQuery{OrgId: 10} query := m.GetDataSourcesQuery{OrgId: 10}
GetDataSources(&query) err = GetDataSources(&query)
So(err, ShouldBeNil)
ds := query.Result[0] ds := query.Result[0]
Convey("Can delete datasource", func() { Convey("Can delete datasource", func() {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment