55 refresh_token : "a-refresh-token" ,
66 client_id : "a-client-id" ,
77 client_secret : "a-client-secret" ,
8- aws_access_key_id : "an-aws-access-key-id" ,
9- aws_secret_access_key : "an-aws-secret-access-key" ,
108 access_token_cache_key : "a-selling_partner_id"
119 }
1210 end
2018 expect ( client . refresh_token ) . not_to be_nil
2119 expect ( client . client_id ) . not_to be_nil
2220 expect ( client . client_secret ) . not_to be_nil
23- expect ( client . aws_access_key_id ) . not_to be_nil
24- expect ( client . aws_secret_access_key ) . not_to be_nil
2521 end
2622
2723 it "sets the Typhoeus user agent to an empty string" do
@@ -52,8 +48,10 @@ def make_a_request(region = "na", query_params: {})
5248
5349 it "gets an access token and signs the headers" do
5450 expect ( Typhoeus ) . to receive ( :get )
55- . with ( "https://#{ hostname } /some_path" , headers : hash_including ( "x-amz-access-token" => fake_lwa_access_token ,
56- "authorization" => a_string_including ( "SignedHeaders=host;x-amz-content-sha256;x-amz-date" ) ) )
51+ . with ( "https://#{ hostname } /some_path" ,
52+ hash_including (
53+ headers : hash_including ( "x-amz-access-token" => fake_lwa_access_token )
54+ ) )
5755 client . make_a_request
5856 end
5957
@@ -83,7 +81,10 @@ def make_a_request(region = "na", query_params: {})
8381 expect_any_instance_of ( MockRedis ) . to receive ( :set ) . with ( "SP-TOKEN-#{ credentials [ :access_token_cache_key ] } " ,
8482 fake_lwa_access_token )
8583 expect ( Typhoeus ) . to receive ( :get )
86- . with ( "https://#{ hostname } /some_path" , headers : hash_including ( "x-amz-access-token" => fake_lwa_access_token ) )
84+ . with ( "https://#{ hostname } /some_path" ,
85+ hash_including (
86+ headers : hash_including ( "x-amz-access-token" => fake_lwa_access_token )
87+ ) )
8788 client . make_a_request
8889 end
8990 end
@@ -97,26 +98,30 @@ def make_a_request(region = "na", query_params: {})
9798 it "uses the stored token" do
9899 expect_any_instance_of ( MockRedis ) . to receive ( :get ) . with ( "SP-TOKEN-#{ credentials [ :access_token_cache_key ] } " ) . and_return ( another_fake_lwa_access_token )
99100 expect ( Typhoeus ) . to receive ( :get )
100- . with ( "https://#{ hostname } /some_path" , headers : hash_including ( "x-amz-access-token" => another_fake_lwa_access_token ) )
101+ . with ( "https://#{ hostname } /some_path" ,
102+ hash_including (
103+ headers : hash_including ( "x-amz-access-token" => another_fake_lwa_access_token )
104+ ) )
101105 client . make_a_request
102106 end
103107 end
104108
105109 context "when using the sandbox environment" do
106110 let ( :sandbox ) { true }
107111 it "correctly builds the canonical api hostname" do
108- expect ( Typhoeus ) . to receive ( :get ) . with ( "https://sandbox.#{ hostname } /some_path" , headers : hash_including ( { } ) )
112+ expect ( Typhoeus ) . to receive ( :get ) . with ( "https://sandbox.#{ hostname } /some_path" ,
113+ hash_including ( headers : hash_including ( { } ) ) )
109114 client . make_a_request
110115 end
111116 end
112117
113118 context "multiple requests with the same client instance" do
114119 it "uses correct query params for each new request" do
115120 expect ( Typhoeus ) . to receive ( :get ) . with ( "https://#{ hostname } /some_path?flavor=blueberry" ,
116- headers : hash_including ( { } ) )
121+ hash_including ( headers : hash_including ( { } ) ) )
117122 client . make_a_request ( query_params : { "flavor" => "blueberry" } )
118123 expect ( Typhoeus ) . to receive ( :get ) . with ( "https://#{ hostname } /some_path?flavor=chocolate" ,
119- headers : hash_including ( { } ) )
124+ hash_including ( headers : hash_including ( { } ) ) )
120125 client . make_a_request ( query_params : { "flavor" => "chocolate" } )
121126 end
122127 end
0 commit comments