organize + graph
This commit is contained in:
45
models/resources/data/data_test.go
Normal file
45
models/resources/data/data_test.go
Normal file
@@ -0,0 +1,45 @@
|
||||
package data
|
||||
|
||||
import (
|
||||
resources "oc-lib/models/resources"
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStoreOneData(t *testing.T) {
|
||||
d := Data{DataType: "jpeg", Example: "123456",
|
||||
AbstractResource: resources.AbstractResource{
|
||||
Uuid: "123",
|
||||
Name: "testData",
|
||||
Description: "Lorem Ipsum",
|
||||
Logo: "azerty.com",
|
||||
Owner: "toto",
|
||||
OwnerLogo: "totoLogo",
|
||||
SourceUrl: "azerty.fr",
|
||||
},
|
||||
}
|
||||
|
||||
dma := DataMongoAccessor{}
|
||||
id := dma.StoreOne(&d)
|
||||
|
||||
assert.NotEmpty(t, id)
|
||||
}
|
||||
|
||||
func TestLoadOneDate(t *testing.T) {
|
||||
d := Data{DataType: "jpeg", Example: "123456",
|
||||
AbstractResource: resources.AbstractResource{
|
||||
Uuid: "123",
|
||||
Name: "testData",
|
||||
Description: "Lorem Ipsum",
|
||||
Logo: "azerty.com",
|
||||
Owner: "toto",
|
||||
OwnerLogo: "totoLogo",
|
||||
SourceUrl: "azerty.fr",
|
||||
},
|
||||
}
|
||||
|
||||
dma := DataMongoAccessor{}
|
||||
new_d := dma.StoreOne(&d)
|
||||
assert.Equal(t, d, new_d)
|
||||
}
|
||||
Reference in New Issue
Block a user