<commit_before>require File.expand_path('../../test_helper', __FILE__)

module Stripe
  class LoginLinkTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:login_link)

    setup do
      account_fixture = API_FIXTURES.fetch(:account)
      @account = Stripe::Account.retrieve(account_fixture[:id])
    end

    should "not be retrievable" do
      assert_raises NotImplementedError do
        Stripe::LoginLink.retrieve('foo')
      end
    end

    should "be creatable" do
      stub_request(:post, "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links").
        to_return(body: JSON.generate(FIXTURE))
      login_link = @account.login_links.create
      assert_requested :post,
        "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links"
      assert login_link.kind_of?(Stripe::LoginLink)
    end
  end
end
<commit_msg>Do not rely on fixtures for login_links as it's not always here.<commit_after>require File.expand_path('../../test_helper', __FILE__)

module Stripe
  class LoginLinkTest < Test::Unit::TestCase
    FIXTURE = API_FIXTURES.fetch(:login_link)

    setup do
      account_fixture = API_FIXTURES.fetch(:account)
      account_fixture = account_fixture.merge(
        'login_links' => {
          'data' => [],
          'has_more' => false,
          'object' => 'list',
          'url' =>  "/v1/accounts/#{account_fixture[:id]}/login_links"
        }
      )
      @account = Stripe::Account.construct_from(account_fixture)
    end

    should "not be retrievable" do
      assert_raises NotImplementedError do
        Stripe::LoginLink.retrieve('foo')
      end
    end

    should "be creatable" do
      stub_request(:post, "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links").
        to_return(body: JSON.generate(FIXTURE))

      login_link = @account.login_links.create
      assert_requested :post,
        "#{Stripe.api_base}/v1/accounts/#{@account.id}/login_links"
      assert login_link.kind_of?(Stripe::LoginLink)
    end
  end
end

{'fraction_non_alphanumeric': 0.12618928392588882, 'fraction_numerical': 0.0025037556334501754, 'mean_word_length': 3.145228215767635, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5903546', 'n_tokens_mistral': 673, 'n_tokens_neox': 661, 'n_words': 113}