2024-07-18 11:51:12 +02:00
|
|
|
package datacenter
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2024-07-18 13:35:14 +02:00
|
|
|
resources "cloud.o-forge.io/core/oc-lib/models/resources"
|
|
|
|
|
2024-07-18 11:51:12 +02:00
|
|
|
"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)
|
|
|
|
}
|