33require_relative "test_helper"
44
55class TestUserDelegationKey < TestCase
6- attr_reader :delegation_key
6+ attr_reader :delegation_key , :account_name , :principal_id , :signer , :host
77 def setup
88 skip if using_shared_key
99 @account_name = ENV [ "AZURE_ACCOUNT_NAME" ]
1010 @principal_id = ENV [ "AZURE_PRINCIPAL_ID" ]
11- @signer = AzureBlob ::EntraIdSigner . new ( account_name : @account_name , principal_id : @principal_id )
12- @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name : @account_name , signer : @signer )
11+ @host = "https://#{ account_name } .blob.core.windows.net"
12+ @signer = AzureBlob ::EntraIdSigner . new ( account_name :, principal_id :, host :)
13+ @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name :, signer :)
1314 end
1415
1516 def test_do_not_refresh_under_expiration_buffer
1617 now = Time . now
1718 five_hours = 18000
1819 Time . stub :now , now do
19- @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name : @account_name , signer : @signer )
20+ @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name :, signer :)
2021 end
2122 initial_expiry = @delegation_key . signed_expiry
2223
@@ -31,7 +32,7 @@ def test_refresh_when_over_expiration_buffer
3132 now = Time . now
3233 after_expiration_buffer = now + 21601
3334 Time . stub :now , now do
34- @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name : @account_name , signer : @signer )
35+ @delegation_key = AzureBlob ::UserDelegationKey . new ( account_name :, signer :)
3536 end
3637
3738 initial_expiry = delegation_key . signed_expiry
0 commit comments