@@ -206,29 +206,8 @@ def common_headers
206206                } 
207207
208208                ::Manticore ::Client . expects ( :new ) . with ( options ) 
209-                 transport  =  Manticore . new  hosts : [ {  host : 'foobar' ,  port : 1234  } ] ,  options : options 
210-               end 
211- 
212-               should  'allow custom headers'  do 
213-                 transport_options  =  {  headers : {  'Authorization'  =>  'Basic token'  }  } 
214-                 transport  =  Manticore . new ( 
215-                   hosts : [ {  host : 'foobar' ,  port : 1234  } ] , 
216-                   transport_options : transport_options 
217-                 ) 
218- 
219-                 assert_equal ( 
220-                   transport . instance_variable_get ( :@request_options ) [ :headers ] [ 'Authorization' ] , 
221-                   'Basic token' 
222-                 ) 
223-                 transport . connections . first . connection 
224-                   . expects ( :get ) 
225-                   . with  do  |_host ,  _options |
226-                   assert_equal ( 'Basic token' ,  _options [ :headers ] [ 'Authorization' ] ) 
227-                   true 
228-                 end 
229-                   . returns ( stub_everything ) 
230- 
231-                 transport . perform_request ( 'GET' ,  '/' ,  { } ) 
209+                 transport  =  Manticore . new ( hosts : [ {  host : 'foobar' ,  port : 1234  } ] ,  options : options ) 
210+                 assert_equal ( transport . options [ :ssl ] [ :truststore_password ] ,  'test' ) 
232211              end 
233212
234213              should  'pass :transport_options to Manticore::Client'  do 
@@ -238,6 +217,45 @@ def common_headers
238217
239218                ::Manticore ::Client . expects ( :new ) . with ( potatoes : 1 ,  ssl : { } ) 
240219                transport  =  Manticore . new ( hosts : [ {  host : 'foobar' ,  port : 1234  } ] ,  options : options ) 
220+                 assert_equal ( transport . options [ :transport_options ] [ :potatoes ] ,  1 ) 
221+               end 
222+ 
223+               context  'custom headers'  do 
224+                 should  'allow authorization headers'  do 
225+                   transport_options  =  {  headers : {  'Authorization'  =>  'Basic token'  }  } 
226+                   transport  =  Manticore . new ( 
227+                     hosts : [ {  host : 'foobar' ,  port : 1234  } ] , 
228+                     transport_options : transport_options 
229+                   ) 
230+ 
231+                   assert_equal ( 
232+                     transport . instance_variable_get ( :@request_options ) [ :headers ] [ 'Authorization' ] , 
233+                     'Basic token' 
234+                   ) 
235+                   transport . connections . first . connection . expects ( :get ) . with  do  |_host ,  options |
236+                     assert_equal ( 'Basic token' ,  options [ :headers ] [ 'Authorization' ] ) 
237+                     true 
238+                   end . returns ( stub_everything ) 
239+                   transport . perform_request ( 'GET' ,  '/' ,  { } ) 
240+                 end 
241+ 
242+                 should  'allow user agent headers'  do 
243+                   transport_options  =  {  headers : {  'User-Agent'  =>  'Custom UA'  }  } 
244+                   transport  =  Manticore . new ( 
245+                     hosts : [ {  host : 'localhost'  } ] , 
246+                     transport_options : transport_options 
247+                   ) 
248+                   transport . connections . first . connection . expects ( :get ) . with  do  |_host ,  options |
249+                     assert_equal ( 'Custom UA' ,  options [ :headers ] [ 'User-Agent' ] ) 
250+                     true 
251+                   end . returns ( stub_everything ) 
252+                   transport . perform_request ( 'GET' ,  '/' ,  { } ) 
253+ 
254+                   assert_equal ( 
255+                     transport . instance_variable_get ( '@request_options' ) [ :headers ] [ 'User-Agent' ] , 
256+                     'Custom UA' 
257+                   ) 
258+                 end 
241259              end 
242260            end 
243261          end 
0 commit comments