diff --git a/lib/fog/aws/requests/sts/get_federation_token.rb b/lib/fog/aws/requests/sts/get_federation_token.rb index 05d1a6748..2a8ce0e3f 100644 --- a/lib/fog/aws/requests/sts/get_federation_token.rb +++ b/lib/fog/aws/requests/sts/get_federation_token.rb @@ -41,6 +41,23 @@ module Fog }) end end + class Mock + def get_federation_token(name, policy, duration=43200) + Excon::Response.new.tap do |response| + response.status = 200 + response.body = { + 'SessionToken' => Fog::Mock.random_base64(580), + 'SecretAccessKey' => Fog::Mock.random_base64(40), + 'Expiration' => (DateTime.now + duration).strftime('%FT%TZ'), + 'AccessKeyId' => Fog::AWS::Mock.key_id(20), + 'Arn' => "arn:aws:sts::#{Fog::AWS::Mock.owner_id}:federated-user/#{name}", + 'FederatedUserId' => "#{Fog::AWS::Mock.owner_id}:#{name}", + 'PackedPolicySize' => Fog::Mock.random_numbers(2), + 'RequestId' => Fog::AWS::Mock.request_id + } + end + end + end end end end diff --git a/tests/aws/requests/sts/get_federation_token_tests.rb b/tests/aws/requests/sts/get_federation_token_tests.rb index 758f2ab9e..469569aa3 100644 --- a/tests/aws/requests/sts/get_federation_token_tests.rb +++ b/tests/aws/requests/sts/get_federation_token_tests.rb @@ -14,7 +14,6 @@ Shindo.tests('AWS::STS | session tokens', ['aws']) do } tests("#get_federation_token('test@fog.io', #{@policy.inspect})").formats(@federation_format) do - pending if Fog.mocking? Fog::AWS[:sts].get_federation_token("test@fog.io", @policy).body end