oc-lib/models/resources/data/data_test.go
2024-07-18 15:35:30 +02:00

47 lines
977 B
Go

package data
import (
"testing"
resources "cloud.o-forge.io/core/oc-lib/models/resources"
"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)
}