mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
cdea4b7713
* ApiProxyList Command * CodeReview Fixes * CodeReview Fixes * CodeReview FIxes * CodeReview Fixes * CodeReview FIxes * CodeReview Fixes * fixing unit test * doc fixes * Update documentation/docs/steps/apiProxyList.md Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com> * CodeReview Fixes * CodeReview Fixes * CodeReview Fixes * codereview fix Co-authored-by: Oliver Feldmann <oliver.feldmann@sap.com>
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)
|
|
})
|
|
}
|