organize + graph
This commit is contained in:
46
models/resources/datacenter/datacenter_test.go
Normal file
46
models/resources/datacenter/datacenter_test.go
Normal file
@@ -0,0 +1,46 @@
|
||||
package datacenter
|
||||
|
||||
import (
|
||||
resources "oc-lib/models/resources"
|
||||
"testing"
|
||||
|
||||
"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)
|
||||
}
|
||||
Reference in New Issue
Block a user