@@ -3,6 +3,7 @@ package versions
33import (
44 "errors"
55 "net/http"
6+ "strconv"
67 "testing"
78
89 mockhttp "github.com/jfrog/jfrog-cli-application/apptrust/http/mocks"
@@ -56,7 +57,7 @@ func TestCreateAppVersion(t *testing.T) {
5657 for _ , tt := range tests {
5758 t .Run (tt .name , func (t * testing.T ) {
5859 mockHttpClient := mockhttp .NewMockApptrustHttpClient (ctrl )
59- mockHttpClient .EXPECT ().Post ("/v1/applications/version" , tt .request ).
60+ mockHttpClient .EXPECT ().Post ("/v1/applications/version" , tt .request , nil ).
6061 Return (tt .mockResponse , []byte (tt .mockResponseBody ), tt .mockError ).Times (1 )
6162
6263 mockCtx := mockservice .NewMockContext (ctrl )
@@ -102,7 +103,7 @@ func TestPromoteAppVersion(t *testing.T) {
102103 ExcludedRepositoryKeys : []string {"repo3" },
103104 },
104105 sync : true ,
105- expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote?async=false " ,
106+ expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote" ,
106107 mockResponse : & http.Response {StatusCode : 200 },
107108 mockResponseBody : "{}" ,
108109 mockError : nil ,
@@ -119,7 +120,7 @@ func TestPromoteAppVersion(t *testing.T) {
119120 ExcludedRepositoryKeys : []string {"repo3" },
120121 },
121122 sync : false ,
122- expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote?async=true " ,
123+ expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote" ,
123124 mockResponse : & http.Response {StatusCode : 202 },
124125 mockResponseBody : "{}" ,
125126 mockError : nil ,
@@ -134,7 +135,7 @@ func TestPromoteAppVersion(t *testing.T) {
134135 PromotionType : model .PromotionTypeCopy ,
135136 },
136137 sync : true ,
137- expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote?async=false " ,
138+ expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote" ,
138139 mockResponse : & http.Response {StatusCode : 400 },
139140 mockResponseBody : "error" ,
140141 mockError : nil ,
@@ -149,7 +150,7 @@ func TestPromoteAppVersion(t *testing.T) {
149150 PromotionType : model .PromotionTypeCopy ,
150151 },
151152 sync : false ,
152- expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote?async=true " ,
153+ expectedEndpoint : "/v1/applications/test-app/versions/1.0.0/promote" ,
153154 mockResponse : nil ,
154155 mockResponseBody : "" ,
155156 mockError : errors .New ("http client error" ),
@@ -160,7 +161,7 @@ func TestPromoteAppVersion(t *testing.T) {
160161 for _ , tt := range tests {
161162 t .Run (tt .name , func (t * testing.T ) {
162163 mockHttpClient := mockhttp .NewMockApptrustHttpClient (ctrl )
163- mockHttpClient .EXPECT ().Post (tt .expectedEndpoint , tt .payload ).
164+ mockHttpClient .EXPECT ().Post (tt .expectedEndpoint , tt .payload , map [ string ] string { "async" : strconv . FormatBool ( ! tt . sync )} ).
164165 Return (tt .mockResponse , []byte (tt .mockResponseBody ), tt .mockError ).Times (1 )
165166
166167 mockCtx := mockservice .NewMockContext (ctrl )
0 commit comments