update go.mod and imports
This commit is contained in:
75
pkg/cloudapi/locations/filter_test.go
Normal file
75
pkg/cloudapi/locations/filter_test.go
Normal file
@@ -0,0 +1,75 @@
|
||||
package locations
|
||||
|
||||
import "testing"
|
||||
|
||||
var locationItems = ListLocations{
|
||||
{
|
||||
GID: 212,
|
||||
ID: 1,
|
||||
GUID: 1,
|
||||
LocationCode: "alfa",
|
||||
Name: "alfa",
|
||||
Flag: "",
|
||||
Meta: []interface{}{
|
||||
"cloudbroker",
|
||||
"location",
|
||||
1,
|
||||
},
|
||||
CKey: "",
|
||||
},
|
||||
{
|
||||
GID: 222,
|
||||
ID: 2,
|
||||
GUID: 2,
|
||||
LocationCode: "beta",
|
||||
Name: "beta",
|
||||
Flag: "",
|
||||
Meta: []interface{}{
|
||||
"cloudbroker",
|
||||
"location",
|
||||
1,
|
||||
},
|
||||
CKey: "",
|
||||
},
|
||||
{
|
||||
GID: 232,
|
||||
ID: 3,
|
||||
GUID: 3,
|
||||
LocationCode: "gamma",
|
||||
Name: "gamma",
|
||||
Flag: "",
|
||||
Meta: []interface{}{
|
||||
"cloudbroker",
|
||||
"location",
|
||||
1,
|
||||
},
|
||||
CKey: "",
|
||||
},
|
||||
}
|
||||
|
||||
func TestFilterByID(t *testing.T) {
|
||||
actual := locationItems.FilterByID(1).FindOne()
|
||||
|
||||
if actual.ID != 1 {
|
||||
t.Fatal("expected ID 1, found: ", actual.ID)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterByName(t *testing.T) {
|
||||
actual := locationItems.FilterByName("gamma").FindOne()
|
||||
|
||||
if actual.Name != "gamma" {
|
||||
t.Fatal("expected Name 'gamma', found: ", actual.Name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFilterFunc(t *testing.T) {
|
||||
actual := locationItems.FilterFunc(func(il ItemLocation) bool {
|
||||
return il.GID == 212
|
||||
}).
|
||||
FindOne()
|
||||
|
||||
if actual.GID != 212 {
|
||||
t.Fatal("expected GID 212, found: ", actual.GID)
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
package locations
|
||||
|
||||
import (
|
||||
"repos.digitalenergy.online/BASIS/decort-golang-sdk/interfaces"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/interfaces"
|
||||
)
|
||||
|
||||
// Structure for creating request to locations
|
||||
|
||||
@@ -3,7 +3,7 @@ package locations
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"repos.digitalenergy.online/BASIS/decort-golang-sdk/internal/serialization"
|
||||
"repository.basistech.ru/BASIS/decort-golang-sdk/internal/serialization"
|
||||
)
|
||||
|
||||
// Serialize returns JSON-serialized []byte. Used as a wrapper over json.Marshal and json.MarshalIndent functions.
|
||||
|
||||
Reference in New Issue
Block a user