mirror of
https://github.com/SAP/jenkins-library.git
synced 2024-12-14 11:03:09 +02:00
ffc931aad1
* Added unit tag as argument. Added description to runTests command. Changed code generator to have unit build tag in generated unit test files. * Added unit build tag to all unit test files. * added to new unit test unit build tag * Update verify-go.yml * small fix --------- Co-authored-by: Muhammadali Nazarov <Muhammadali.Nazarov@acronis.com> Co-authored-by: Christopher Fenner <26137398+CCFenner@users.noreply.github.com>
31 lines
876 B
Go
31 lines
876 B
Go
//go:build unit
|
|
// +build unit
|
|
|
|
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)
|
|
})
|
|
}
|