46 lines
947 B
Go
46 lines
947 B
Go
package oclib
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestStoreOneDatacenter(t *testing.T){
|
|
dc := Datacenter{Owner: "toto", BookingPrice: 123,
|
|
AbstractResource: 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: AbstractResource{
|
|
Uuid: "123",
|
|
Name: "testDatacenter",
|
|
Description: "Lorem Ipsum",
|
|
Logo : "azerty.com",
|
|
Owner: "toto",
|
|
OwnerLogo: "totoLogo",
|
|
SourceUrl: "azerty.fr",
|
|
},
|
|
}
|
|
|
|
dcma := DatacenterMongoAccessor{}
|
|
id := dcma.StoreOne(dc)
|
|
new_dc := dcma.LoadOne(id)
|
|
|
|
assert.Equal(t,dc, new_dc)
|
|
} |