|
@@ -30,7 +30,6 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
|
assert_match /\-\-\> 200/, @logger.logged(:info)[1]
|
|
|
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
|
|
assert_match /Response:\n\{\"page\"\:\{((\"id\"\:1)|(\"title\"\:\"Shopify API\")),((\"id\"\:1)|(\"title\"\:\"Shopify API\"))\}\}/, @logger.logged(:info)[3]
|
|
|
-
|
|
|
end
|
|
|
|
|
|
test "logging on #find with an error" do
|
|
@@ -46,4 +45,23 @@ class LogSubscriberTest < Test::Unit::TestCase
|
|
|
assert_equal "Headers: {\"Accept\"=>\"application/json\", #{@ua_header}}", @logger.logged(:info)[2]
|
|
|
assert_equal "Response:", @logger.logged(:info)[3]
|
|
|
end
|
|
|
+
|
|
|
+ test "warns when the server responds with a x-shopify-api-deprecated-reason header" do
|
|
|
+ fake(
|
|
|
+ "pages/1",
|
|
|
+ method: :get,
|
|
|
+ body: @page,
|
|
|
+ x_shopify_api_deprecated_reason: 'https://help.shopify.com/en/api/getting-started/api-deprecations'
|
|
|
+ )
|
|
|
+
|
|
|
+ ShopifyAPI::Page.find(1)
|
|
|
+
|
|
|
+ assert_equal 1, @logger.logged(:warn).size
|
|
|
+
|
|
|
+ assert_match %r{\[DEPRECATED\] ShopifyAPI made a call to GET \/admin\/pages\/1.json}, @logger.logged(:warn).first
|
|
|
+ assert_match(
|
|
|
+ %r{See https:\/\/help.shopify.com\/en\/api\/getting-started\/api-deprecations for more details.},
|
|
|
+ @logger.logged(:warn).first
|
|
|
+ )
|
|
|
+ end
|
|
|
end
|