tests for each model
This commit is contained in:
47
storage_test.go
Normal file
47
storage_test.go
Normal file
@@ -0,0 +1,47 @@
|
||||
package oclib
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestStoreOneStorage(t *testing.T){
|
||||
s := Storage{ Capacity: 123, Url: URL{Protocol: "http",Path: "azerty.fr"} ,
|
||||
AbstractResource: AbstractResource{
|
||||
Uuid: "123",
|
||||
Name: "testData",
|
||||
Description: "Lorem Ipsum",
|
||||
Logo : "azerty.com",
|
||||
Owner: "toto",
|
||||
OwnerLogo: "totoLogo",
|
||||
SourceUrl: "azerty.fr",
|
||||
},
|
||||
}
|
||||
|
||||
sma := StorageMongoAccessor{}
|
||||
id := sma.StoreOne(s)
|
||||
|
||||
assert.NotEmpty(t, id)
|
||||
}
|
||||
|
||||
func TestLoadOneStorage(t *testing.T){
|
||||
s := Storage{ Capacity: 123, Url: URL{Protocol: "http",Path: "azerty.fr"} ,
|
||||
AbstractResource: AbstractResource{
|
||||
Uuid: "123",
|
||||
Name: "testData",
|
||||
Description: "Lorem Ipsum",
|
||||
Logo : "azerty.com",
|
||||
Owner: "toto",
|
||||
OwnerLogo: "totoLogo",
|
||||
SourceUrl: "azerty.fr",
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
sma := StorageMongoAccessor{}
|
||||
id := sma.StoreOne(s)
|
||||
new_s := sma.LoadOne(id)
|
||||
|
||||
assert.Equal(t,s, new_s)
|
||||
}
|
||||
Reference in New Issue
Block a user