Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielMieg committed Dec 6, 2023
1 parent cdadacf commit cc5ab01
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions cmd/abapEnvironmentCreateTag_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,15 @@ repositories:
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -101,14 +101,14 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 22, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, `Created tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[16].Message, "Expected a different message")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[21].Message, "Expected a different message")
assert.Equal(t, 25, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
assert.Equal(t, `Created tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[18].Message, "Expected a different message")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[24].Message, "Expected a different message")
hook.Reset()
})

Expand Down Expand Up @@ -153,17 +153,17 @@ repositories:
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : { "empty" : "body" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
`{"d" : { "empty" : "body" } }`,
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "E" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -176,15 +176,15 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.Error(t, err, "Did expect error")
assert.Equal(t, 37, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `NOT created: Tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[23].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[35].Message, "Expected a different message")
assert.Equal(t, `At least one tag has not been created`, hook.AllEntries()[36].Message, "Expected a different message")
assert.Equal(t, 40, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `NOT created: Tag v4.5.6 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag -DMO-PRODUCT-1.2.3 for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[25].Message, "Expected a different message")
assert.Equal(t, `NOT created: Tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[38].Message, "Expected a different message")
assert.Equal(t, `At least one tag has not been created`, hook.AllEntries()[39].Message, "Expected a different message")
hook.Reset()

})
Expand Down Expand Up @@ -215,7 +215,7 @@ func TestRunAbapEnvironmentCreateTagConfigurations(t *testing.T) {
}
client := &abaputils.ClientMock{
BodyList: []string{
`{"d" : ` + executionLogStringClone + `}`,
`{"d" : ` + executionLogStringCreateTag + `}`,
logResultSuccess,
`{"d" : { "Status" : "S" } }`,
`{"d" : { "uuid" : "abc" } }`,
Expand All @@ -228,12 +228,12 @@ func TestRunAbapEnvironmentCreateTagConfigurations(t *testing.T) {
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err := runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 12, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[11].Message, "Expected a different message")
assert.Equal(t, 13, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[12].Message, "Expected a different message")
hook.Reset()
})

Expand Down Expand Up @@ -296,7 +296,7 @@ repositories:
StatusCode: 200,
}

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.Error(t, err, "Did expect error")
Expand Down Expand Up @@ -359,12 +359,12 @@ repositories:
_, hook := test.NewNullLogger()
log.RegisterHook(hook)

apiManager = &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
apiManager := &abaputils.SoftwareComponentApiManager{Client: client, PollIntervall: 1 * time.Nanosecond, Force0510: true}
err = runAbapEnvironmentCreateTag(config, autils, apiManager)

assert.NoError(t, err, "Did not expect error")
assert.Equal(t, 5, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[4].Message, "Expected a different message")
assert.Equal(t, 6, len(hook.Entries), "Expected a different number of entries")
assert.Equal(t, `Created tag tag for repository /DMO/SWC with commitID 1234abcd`, hook.AllEntries()[5].Message, "Expected a different message")
hook.Reset()

})
Expand Down

0 comments on commit cc5ab01

Please sign in to comment.