You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-11-06 09:09:19 +02:00
This reverts commit e6086ad4a7.
This commit is contained in:
@@ -15,9 +15,7 @@ import (
|
||||
)
|
||||
|
||||
func TestCloudFoundryGetAbapCommunicationInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("CF GetAbapCommunicationArrangementInfo - Error - parameters missing", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
//given
|
||||
options := AbapEnvironmentOptions{
|
||||
@@ -47,7 +45,6 @@ func TestCloudFoundryGetAbapCommunicationInfo(t *testing.T) {
|
||||
assert.EqualError(t, err, "Parameters missing. Please provide EITHER the Host of the ABAP server OR the Cloud Foundry ApiEndpoint, Organization, Space, Service Instance and a corresponding Service Key for the Communication Scenario SAP_COM_0510")
|
||||
})
|
||||
t.Run("CF GetAbapCommunicationArrangementInfo - Error - reading service Key", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
//given
|
||||
options := AbapEnvironmentOptions{
|
||||
CfAPIEndpoint: "https://api.endpoint.com",
|
||||
@@ -76,7 +73,7 @@ func TestCloudFoundryGetAbapCommunicationInfo(t *testing.T) {
|
||||
assert.EqualError(t, err, "Read service key failed: Parsing the service key failed. Service key is empty")
|
||||
})
|
||||
t.Run("CF GetAbapCommunicationArrangementInfo - Success", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
//given
|
||||
|
||||
const testURL = "https://testurl.com"
|
||||
@@ -118,9 +115,8 @@ func TestCloudFoundryGetAbapCommunicationInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestHostGetAbapCommunicationInfo(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("HOST GetAbapCommunicationArrangementInfo - Success", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
//given
|
||||
|
||||
const testURL = "https://testurl.com"
|
||||
@@ -157,7 +153,7 @@ func TestHostGetAbapCommunicationInfo(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
t.Run("HOST GetAbapCommunicationArrangementInfo - Success - w/o https", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
//given
|
||||
|
||||
const testURL = "testurl.com"
|
||||
@@ -196,10 +192,8 @@ func TestHostGetAbapCommunicationInfo(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReadServiceKeyAbapEnvironment(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("CF ReadServiceKeyAbapEnvironment - Failed to login to Cloud Foundry", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
//given
|
||||
//given .
|
||||
options := AbapEnvironmentOptions{
|
||||
Username: "testUser",
|
||||
Password: "testPassword",
|
||||
@@ -234,23 +228,19 @@ func TestReadServiceKeyAbapEnvironment(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTimeConverter(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Test example time", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
inputDate := "/Date(1585576809000+0000)/"
|
||||
expectedDate := "2020-03-30 14:00:09 +0000 UTC"
|
||||
result := ConvertTime(inputDate)
|
||||
assert.Equal(t, expectedDate, result.String(), "Dates do not match after conversion")
|
||||
})
|
||||
t.Run("Test Unix time", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
inputDate := "/Date(0000000000000+0000)/"
|
||||
expectedDate := "1970-01-01 00:00:00 +0000 UTC"
|
||||
result := ConvertTime(inputDate)
|
||||
assert.Equal(t, expectedDate, result.String(), "Dates do not match after conversion")
|
||||
})
|
||||
t.Run("Test unexpected format", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
inputDate := "/Date(0012300000001+0000)/"
|
||||
expectedDate := "1970-01-01 00:00:00 +0000 UTC"
|
||||
result := ConvertTime(inputDate)
|
||||
@@ -259,9 +249,7 @@ func TestTimeConverter(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestReadAddonDescriptor(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Test: success case", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
dir, err := ioutil.TempDir("", "test read addon descriptor")
|
||||
if err != nil {
|
||||
@@ -315,7 +303,6 @@ repositories:
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
t.Run("Test: file does not exist", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
expectedErrorMessage := "AddonDescriptor doesn't contain any repositories"
|
||||
|
||||
addonDescriptor, err := ReadAddonDescriptor("filename.yaml")
|
||||
@@ -326,7 +313,6 @@ repositories:
|
||||
assert.EqualError(t, err, expectedErrorMessage)
|
||||
})
|
||||
t.Run("Test: empty config - failure case", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
expectedErrorMessage := "AddonDescriptor doesn't contain any repositories"
|
||||
|
||||
addonDescriptor, err := ReadAddonDescriptor("")
|
||||
@@ -372,9 +358,8 @@ repositories:
|
||||
}
|
||||
|
||||
func TestHandleHTTPError(t *testing.T) {
|
||||
t.Parallel()
|
||||
t.Run("Test", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
errorValue := "Received Error"
|
||||
abapErrorCode := "abapErrorCode"
|
||||
abapErrorMessage := "abapErrorMessage"
|
||||
@@ -395,7 +380,7 @@ func TestHandleHTTPError(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Non JSON Error", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
errorValue := "Received Error"
|
||||
bodyString := `Error message`
|
||||
body := []byte(bodyString)
|
||||
@@ -414,7 +399,7 @@ func TestHandleHTTPError(t *testing.T) {
|
||||
})
|
||||
|
||||
t.Run("Different JSON Error", func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
errorValue := "Received Error"
|
||||
bodyString := `{"abap" : { "key" : "value" } }`
|
||||
body := []byte(bodyString)
|
||||
|
||||
Reference in New Issue
Block a user