SEBA-705 better error reporting
Change-Id: Id461c6efe2d0b7ab9c0d1ddb72482d10899b16fe
diff --git a/commands/models_test.go b/commands/models_test.go
index c4f6c47..3a6031b 100644
--- a/commands/models_test.go
+++ b/commands/models_test.go
@@ -2,7 +2,7 @@
* Portions copyright 2019-present Open Networking Foundation
* Original copyright 2019-present Ciena Corporation
*
- * Licensed under the Apache License, Version 2.0 (the "License");
+ * Licensed under the Apache License, Version 2.0 (the"github.com/stretchr/testify/assert" "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
@@ -18,7 +18,9 @@
import (
"bytes"
+ corderrors "github.com/opencord/cordctl/error"
"github.com/opencord/cordctl/testutils"
+ "github.com/stretchr/testify/assert"
"testing"
"time"
)
@@ -267,7 +269,9 @@
options.Update.IDArgs.ID = []int32{77}
options.Update.SetFields = "name=mockslice1_newname"
err := options.Update.Execute([]string{})
- testutils.AssertErrorEqual(t, err, "rpc error: code = Unknown desc = Slice matching query does not exist.")
+
+ _, matched := err.(*corderrors.ModelNotFoundError)
+ assert.True(t, matched)
}
func TestModelUpdateUsingFilterNoExist(t *testing.T) {
@@ -281,7 +285,8 @@
options.Update.SetFields = "name=mockslice1_newname"
err := options.Update.Execute([]string{})
- testutils.AssertErrorEqual(t, err, "Filter matches no objects")
+ _, matched := err.(*corderrors.NoMatchError)
+ assert.True(t, matched)
}
func TestModelCreate(t *testing.T) {
@@ -373,7 +378,9 @@
options.Delete.OutputAs = "json"
options.Delete.Filter = "id=77"
err := options.Delete.Execute([]string{})
- testutils.AssertErrorEqual(t, err, "Filter matches no objects")
+
+ _, matched := err.(*corderrors.NoMatchError)
+ assert.True(t, matched)
}
func TestModelSync(t *testing.T) {