47 lines
920 B
Go
47 lines
920 B
Go
|
package data
|
||
|
|
||
|
import (
|
||
|
oclib "oc-lib"
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestStoreOneData(t *testing.T){
|
||
|
d := Data{DataType: "jpeg", Example: "123456",
|
||
|
AbstractResource: oclib.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: oclib.AbstractResource{
|
||
|
Uuid: "123",
|
||
|
Name: "testData",
|
||
|
Description: "Lorem Ipsum",
|
||
|
Logo : "azerty.com",
|
||
|
Owner: "toto",
|
||
|
OwnerLogo: "totoLogo",
|
||
|
SourceUrl: "azerty.fr",
|
||
|
},
|
||
|
}
|
||
|
|
||
|
dma := DataMongoAccessor{}
|
||
|
id := dma.StoreOne(d)
|
||
|
new_d := dma.LoadOne(id)
|
||
|
|
||
|
assert.Equal(t,d, new_d)
|
||
|
}
|