Skip to content

Commit

Permalink
Explore quota exceeded
Browse files Browse the repository at this point in the history
  • Loading branch information
hakanensari committed Sep 30, 2024
1 parent 6e7ecc7 commit 243acbb
Show file tree
Hide file tree
Showing 3 changed files with 143 additions and 2 deletions.
6 changes: 4 additions & 2 deletions test/helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,10 @@ module FeatureHelpers
include Configurable, Recordable

def api(grantless: false)
access_token = request_access_token(grantless:)
@api ||= api_class.new(aws_region, access_token)
@api ||= begin
access_token = request_access_token(grantless:)
api_class.new(aws_region, access_token)
end
end

def api_class
Expand Down
27 changes: 27 additions & 0 deletions test/peddler/error/quota_exceeded_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# frozen_string_literal: true

require "helper"

require "peddler/api/product_pricing_v0"

module Peddler
class Error
class QuotaExceededTest < Minitest::Test
include FeatureHelpers

# I depleted quota before recording this test.
def test_status
error = assert_raises(QuotaExceeded) do
api.get_pricing("A1F83G8C2ARO7P", "Asin", asins: ["188864544X"])
end
assert_equal(429, error.cause.status)
end

private

def api_class
API::ProductPricingV0
end
end
end
end
112 changes: 112 additions & 0 deletions test/vcr_cassettes/Peddler/Error/QuotaExceededTest/test_status.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 243acbb

Please sign in to comment.