Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/models/apple/api.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def self.api_base
end

def self.api_aud_name
ENV["APPLE_PODCASTS_CONNECT_AUD_NAME"]
ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"]
end

def self.from_key(apple_key)
Expand Down
6 changes: 6 additions & 0 deletions test/models/apple/api_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,19 @@
payload = decoded.first

assert_equal payload["iss"], provider_id
assert_equal payload["aud"], "aardvark"
assert Time.at(payload["exp"]).utc.to_datetime > Time.now.utc + 14.minutes

algo = decoded.second

assert_equal algo, "typ" => "JWT", "alg" => "ES256", "kid" => key_id
end

it "includes the aud from the environment variable" do
assert_equal "aardvark", Apple::Api.api_aud_name
assert_equal ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"], Apple::Api.api_aud_name
end

describe "#local_api_retry_errors" do
it "local api attempts exhausts retries until failure" do
attempts = 0
Expand Down
1 change: 1 addition & 0 deletions test/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
ENV["ACTIVE_RECORD_ENCRYPTION_KEY_DERIVATION_SALT"] = "maybeyouarefeelingsaltyaboutthis"
ENV["PODPING_AUTH_TOKEN"] = "test_token"
ENV["APPLE_PODCASTS_CONNECT_API_URL"] = "https://aardvark.prx.org/"
ENV["APPLE_PODCASTS_CONNECT_API_AUD_NAME"] = "aardvark"

ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
Expand Down
Loading