mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
28 lines
844 B
Go
28 lines
844 B
Go
|
package apim
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/stretchr/testify/assert"
|
||
|
)
|
||
|
|
||
|
func TestOdataQueryInitExisting(t *testing.T) {
|
||
|
t.Run("MakeOdataQuery- Success Test", func(t *testing.T) {
|
||
|
odataFilterInputs := OdataParameters{Filter: "isCopy eq false", Search: "",
|
||
|
Top: 4, Skip: 1, Orderby: "name",
|
||
|
Select: "", Expand: ""}
|
||
|
odataFilters, err := OdataUtils.MakeOdataQuery(&odataFilterInputs)
|
||
|
assert.NoError(t, err)
|
||
|
assert.Equal(t, "?filter=isCopy+eq+false&$orderby=name&$skip=1&$top=4", odataFilters)
|
||
|
})
|
||
|
|
||
|
t.Run("MakeOdataQuery- empty odata filters Test", func(t *testing.T) {
|
||
|
odataFilterInputs := OdataParameters{Filter: "", Search: "",
|
||
|
Top: 0, Skip: 0, Orderby: "",
|
||
|
Select: "", Expand: ""}
|
||
|
odataFilters, err := OdataUtils.MakeOdataQuery(&odataFilterInputs)
|
||
|
assert.NoError(t, err)
|
||
|
assert.Equal(t, "", odataFilters)
|
||
|
})
|
||
|
}
|