Skip to content

Commit

Permalink
test: status
Browse files Browse the repository at this point in the history
  • Loading branch information
brokeyourbike committed Apr 15, 2024
1 parent e7528f1 commit 0b0d40d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions fx_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func TestExecuteFxQuote(t *testing.T) {
ctx := clearbank.RequestIdContext(context.TODO(), "123")
mockSigner.On("Sign", ctx, mock.Anything).Return([]byte("signed"), nil).Once()

resp := &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(nil))}
resp := &http.Response{StatusCode: http.StatusAccepted, Body: io.NopCloser(bytes.NewReader(nil))}
mockHttpClient.On("Do", mock.AnythingOfType("*http.Request")).Return(resp, nil).Once()

assert.NoError(t, client.ExecuteFxQuote(ctx, clearbank.FXPayload{}))
Expand All @@ -63,7 +63,7 @@ func TestExecuteFxQuote_RequestIdFromCtx(t *testing.T) {
ctx := clearbank.RequestIdContext(context.TODO(), "123")
mockSigner.On("Sign", ctx, mock.Anything).Return([]byte("signed"), nil).Once()

resp := &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(nil))}
resp := &http.Response{StatusCode: http.StatusAccepted, Body: io.NopCloser(bytes.NewReader(nil))}
mockHttpClient.On("Do", mock.MatchedBy(func(req *http.Request) bool { return slices.Contains(req.Header["X-Request-Id"], "123") })).Return(resp, nil).Once()

assert.NoError(t, client.ExecuteFxQuote(ctx, clearbank.FXPayload{}))
Expand All @@ -80,7 +80,7 @@ func TestExecuteFxQuote_RequestIdFromFunc(t *testing.T) {
ctx := context.TODO()
mockSigner.On("Sign", ctx, mock.Anything).Return([]byte("signed"), nil).Once()

resp := &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(nil))}
resp := &http.Response{StatusCode: http.StatusAccepted, Body: io.NopCloser(bytes.NewReader(nil))}
mockHttpClient.On("Do", mock.MatchedBy(func(req *http.Request) bool { return slices.Contains(req.Header["X-Request-Id"], "456") })).Return(resp, nil).Once()

assert.NoError(t, client.ExecuteFxQuote(ctx, clearbank.FXPayload{}))
Expand All @@ -97,7 +97,7 @@ func TestExecuteFxQuote_RequestIdFromCtxAndFunc(t *testing.T) {
ctx := clearbank.RequestIdContext(context.TODO(), "123")
mockSigner.On("Sign", ctx, mock.Anything).Return([]byte("signed"), nil).Once()

resp := &http.Response{StatusCode: http.StatusOK, Body: io.NopCloser(bytes.NewReader(nil))}
resp := &http.Response{StatusCode: http.StatusAccepted, Body: io.NopCloser(bytes.NewReader(nil))}
// ctx takex priority and overrides the func
mockHttpClient.On("Do", mock.MatchedBy(func(req *http.Request) bool { return slices.Contains(req.Header["X-Request-Id"], "123") })).Return(resp, nil).Once()

Expand Down

0 comments on commit 0b0d40d

Please sign in to comment.