package datacenter import ( "testing" resources "cloud.o-forge.io/core/oc-lib/models/resources" "cloud.o-forge.io/core/oc-lib/models/utils" "github.com/stretchr/testify/assert" ) func TestStoreOneDatacenter(t *testing.T) { dc := DatacenterResource{Owner: "toto", BookingPrice: 123, AbstractResource: resources.AbstractResource{ AbstractObject: utils.AbstractObject{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 := DatacenterResource{Owner: "toto", BookingPrice: 123, AbstractResource: resources.AbstractResource{ AbstractObject: utils.AbstractObject{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) }