48 lines
1.1 KiB
Go
48 lines
1.1 KiB
Go
package compute
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"cloud.o-forge.io/core/oc-lib/models/resources/resource_model"
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
"cloud.o-forge.io/core/oc-lib/tools"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestStoreOneCompute(t *testing.T) {
|
|
dc := ComputeResource{
|
|
AbstractResource: resource_model.AbstractResource{
|
|
AbstractObject: utils.AbstractObject{Name: "testCompute"},
|
|
Description: "Lorem Ipsum",
|
|
Logo: "azerty.com",
|
|
Owner: "toto",
|
|
OwnerLogo: "totoLogo",
|
|
SourceUrl: "azerty.fr",
|
|
},
|
|
}
|
|
|
|
dcma := New(tools.COMPUTE_RESOURCE, "", nil, nil)
|
|
id, _, _ := dcma.StoreOne(&dc)
|
|
|
|
assert.NotEmpty(t, id)
|
|
}
|
|
|
|
func TestLoadOneCompute(t *testing.T) {
|
|
dc := ComputeResource{
|
|
AbstractResource: resource_model.AbstractResource{
|
|
AbstractObject: utils.AbstractObject{Name: "testCompute"},
|
|
Description: "Lorem Ipsum",
|
|
Logo: "azerty.com",
|
|
Owner: "toto",
|
|
OwnerLogo: "totoLogo",
|
|
SourceUrl: "azerty.fr",
|
|
},
|
|
}
|
|
|
|
dcma := New(tools.COMPUTE_RESOURCE, "", nil, nil)
|
|
new_dc, _, _ := dcma.StoreOne(&dc)
|
|
|
|
assert.Equal(t, dc, new_dc)
|
|
}
|