Sha256: 595abdd005ca510733739445bf5d916c6e8c127e0b549cec9b624b886e4cadb3

Contents?: true

Size: 1.08 KB

Versions: 68

Compression:

Stored size: 1.08 KB

Contents

require_relative 'test_helper'

# Internal: The test for Plaid::Identity.
class PlaidIdentityTest < PlaidTest
  def test_get
    create_item initial_products: [:identity]

    identity_get_request = Plaid::IdentityGetRequest.new
    identity_get_request.access_token = access_token

    response = client.identity_get(identity_get_request)
    assert_kind_of(Plaid::IdentityGetResponse, response)

    refute_empty(response.accounts)

    response.accounts.each do |account|
      refute_empty(account.owners)
      account.owners.each do |identity|
        refute_empty(identity.addresses)
        refute_empty(identity.emails)
        refute_empty(identity.names)
        refute_empty(identity.phone_numbers)
      end
    end
  end

  def test_get_invalid_access_token
    identity_get_request = Plaid::IdentityGetRequest.new
    identity_get_request.access_token = BAD_STRING

    begin
      client.identity_get(identity_get_request)
    rescue Plaid::ApiError => e
      json_response = JSON.parse(e.response_body)
      assert_equal(json_response["error_code"], "INVALID_ACCESS_TOKEN")
    end
  end
end

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
plaid-14.2.0 test/test_identity.rb
plaid-14.1.0 test/test_identity.rb
plaid-14.0.0 test/test_identity.rb
plaid-14.0.0.beta.5 test/test_identity.rb
plaid-14.0.0.beta.4 test/test_identity.rb
plaid-14.0.0.beta.3 test/test_identity.rb
plaid-14.0.0.beta.2 test/test_identity.rb
plaid-14.0.0.beta.1 test/test_identity.rb