7878 help = 'Retrieve the latest pacts for this provider' )
7979@click .option (
8080 'headers' , '--custom-provider-header' ,
81- # envvar='CUSTOM_PROVIDER_HEADER',
81+ envvar = 'CUSTOM_PROVIDER_HEADER' ,
8282 multiple = True ,
8383 help = 'Header to add to provider state set up and '
8484 'pact verification requests. '
@@ -166,16 +166,7 @@ def main(pacts, base_url, pact_url, pact_urls, states_url, states_setup_url,
166166 command .extend (["--custom-provider-header={}" .format (header )])
167167
168168 if publish_verification_results :
169- if not provider_app_version :
170- click .echo (
171- error
172- + 'Provider application version is required '
173- + 'to publish verification results to broker'
174- )
175- raise click .Abort ()
176- command .extend (["--provider-app-version" ,
177- provider_app_version ,
178- "--publish-verification-results" ])
169+ publish_results (error , provider_app_version , command )
179170
180171 if verbose :
181172 command .extend (['--verbose' ])
@@ -190,6 +181,20 @@ def main(pacts, base_url, pact_url, pact_urls, states_url, states_setup_url,
190181 sys .exit (p .returncode )
191182
192183
184+ def publish_results (error , provider_app_version , command ):
185+ """Publish results to broker."""
186+ if not provider_app_version :
187+ click .echo (
188+ error
189+ + 'Provider application version is required '
190+ + 'to publish verification results to broker'
191+ )
192+ raise click .Abort ()
193+ command .extend (["--provider-app-version" ,
194+ provider_app_version ,
195+ "--publish-verification-results" ])
196+
197+
193198def broker_not_provided (broker_base_url , provider ):
194199 """Check if broker not provided."""
195200 return (broker_base_url == '' or provider == '' )
0 commit comments