oc-lib/models/resources/datacenter/datacenter_test.go
2024-07-18 15:35:30 +02:00

48 lines
1.0 KiB
Go

package datacenter
import (
"testing"
resources "cloud.o-forge.io/core/oc-lib/models/resources"
"github.com/stretchr/testify/assert"
)
func TestStoreOneDatacenter(t *testing.T) {
dc := Datacenter{Owner: "toto", BookingPrice: 123,
AbstractResource: resources.AbstractResource{
Uuid: "123",
Name: "testDatacenter",
Description: "Lorem Ipsum",
Logo: "azerty.com",
Owner: "toto",
OwnerLogo: "totoLogo",
SourceUrl: "azerty.fr",
},
}
dcma := DatacenterMongoAccessor{}
id, _ := dcma.StoreOne(&dc)
assert.NotEmpty(t, id)
}
func TestLoadOneDatacenter(t *testing.T) {
dc := Datacenter{Owner: "toto", BookingPrice: 123,
AbstractResource: resources.AbstractResource{
Uuid: "123",
Name: "testDatacenter",
Description: "Lorem Ipsum",
Logo: "azerty.com",
Owner: "toto",
OwnerLogo: "totoLogo",
SourceUrl: "azerty.fr",
},
}
dcma := DatacenterMongoAccessor{}
new_dc, _ := dcma.StoreOne(&dc)
assert.Equal(t, dc, new_dc)
}