46 lines
1.1 KiB
Go
46 lines
1.1 KiB
Go
package processing
|
|
|
|
import (
|
|
"testing"
|
|
|
|
resources "cloud.o-forge.io/core/oc-lib/models/resources"
|
|
"cloud.o-forge.io/core/oc-lib/models/utils"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestStoreOneProcessing(t *testing.T) {
|
|
p := ProcessingResource{Container: "totoCont",
|
|
AbstractResource: resources.AbstractResource{
|
|
AbstractObject: utils.AbstractObject{Name: "testData"},
|
|
Description: "Lorem Ipsum",
|
|
Logo: "azerty.com",
|
|
Owner: "toto",
|
|
OwnerLogo: "totoLogo",
|
|
SourceUrl: "azerty.fr",
|
|
},
|
|
}
|
|
|
|
sma := ProcessingMongoAccessor{}
|
|
id, _ := sma.StoreOne(&p)
|
|
|
|
assert.NotEmpty(t, id)
|
|
}
|
|
|
|
func TestLoadOneProcessing(t *testing.T) {
|
|
p := ProcessingResource{Container: "totoCont",
|
|
AbstractResource: resources.AbstractResource{
|
|
AbstractObject: utils.AbstractObject{Name: "testData"},
|
|
Description: "Lorem Ipsum",
|
|
Logo: "azerty.com",
|
|
Owner: "toto",
|
|
OwnerLogo: "totoLogo",
|
|
SourceUrl: "azerty.fr",
|
|
},
|
|
}
|
|
|
|
sma := ProcessingMongoAccessor{}
|
|
new_s, _ := sma.StoreOne(&p)
|
|
assert.Equal(t, p, new_s)
|
|
}
|