package datacenter

import (
	"testing"

	"cloud.o-forge.io/core/oc-lib/models/resource_model"
	"cloud.o-forge.io/core/oc-lib/models/utils"

	"github.com/stretchr/testify/assert"
)

func TestStoreOneDatacenter(t *testing.T) {
	dc := DatacenterResource{
		AbstractResource: resource_model.AbstractResource{
			AbstractObject: utils.AbstractObject{Name: "testDatacenter"},
			Description:    "Lorem Ipsum",
			Logo:           "azerty.com",
			Owner:          "toto",
			OwnerLogo:      "totoLogo",
			SourceUrl:      "azerty.fr",
		},
	}

	dcma := New()
	id, _, _ := dcma.StoreOne(&dc)

	assert.NotEmpty(t, id)
}

func TestLoadOneDatacenter(t *testing.T) {
	dc := DatacenterResource{
		AbstractResource: resource_model.AbstractResource{
			AbstractObject: utils.AbstractObject{Name: "testDatacenter"},
			Description:    "Lorem Ipsum",
			Logo:           "azerty.com",
			Owner:          "toto",
			OwnerLogo:      "totoLogo",
			SourceUrl:      "azerty.fr",
		},
	}

	dcma := New()
	new_dc, _, _ := dcma.StoreOne(&dc)

	assert.Equal(t, dc, new_dc)
}
