add event base intelligency
This commit is contained in:
@@ -27,10 +27,10 @@ func TestDataResource_GetAccessor(t *testing.T) {
|
||||
func TestDataResource_ConvertToPricedResource(t *testing.T) {
|
||||
d := &resources.DataResource{}
|
||||
d.UUID = "123"
|
||||
res := d.ConvertToPricedResource(tools.DATA_RESOURCE, &tools.APIRequest{})
|
||||
res, _ := d.ConvertToPricedResource(tools.DATA_RESOURCE, nil, nil, nil, nil, nil, &tools.APIRequest{})
|
||||
assert.IsType(t, &resources.PricedDataResource{}, res)
|
||||
|
||||
nilRes := d.ConvertToPricedResource(tools.PROCESSING_RESOURCE, &tools.APIRequest{})
|
||||
nilRes, _ := d.ConvertToPricedResource(tools.PROCESSING_RESOURCE, nil, nil, nil, nil, nil, &tools.APIRequest{})
|
||||
assert.Nil(t, nilRes)
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ func TestDataResourcePricingProfile_IsPurchased(t *testing.T) {
|
||||
assert.True(t, profile.IsPurchasable())
|
||||
}
|
||||
|
||||
func TestPricedDataResource_GetPrice(t *testing.T) {
|
||||
func TestPricedDataResource_GetPriceHT(t *testing.T) {
|
||||
now := time.Now()
|
||||
later := now.Add(1 * time.Hour)
|
||||
mockPrice := 42.0
|
||||
@@ -92,23 +92,25 @@ func TestPricedDataResource_GetPrice(t *testing.T) {
|
||||
|
||||
r := &resources.PricedDataResource{
|
||||
PricedResource: resources.PricedResource{
|
||||
UsageStart: &now,
|
||||
UsageEnd: &later,
|
||||
BookingConfiguration: &resources.BookingConfiguration{
|
||||
UsageStart: &now,
|
||||
UsageEnd: &later,
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
price, err := r.GetPrice()
|
||||
price, err := r.GetPriceHT()
|
||||
require.NoError(t, err)
|
||||
assert.Equal(t, mockPrice, price)
|
||||
}
|
||||
|
||||
func TestPricedDataResource_GetPrice_NoProfiles(t *testing.T) {
|
||||
func TestPricedDataResource_GetPriceHT_NoProfiles(t *testing.T) {
|
||||
r := &resources.PricedDataResource{
|
||||
PricedResource: resources.PricedResource{
|
||||
ResourceID: "test-resource",
|
||||
},
|
||||
}
|
||||
_, err := r.GetPrice()
|
||||
_, err := r.GetPriceHT()
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "pricing profile must be set")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user