<commit_before>require 'test_helper'

class RemoteSecurePayAuTest < Test::Unit::TestCase

  def setup
    @gateway = SecurePayAuGateway.new(fixtures(:secure_pay_au))

    @amount = 100
    @credit_card = credit_card('4242424242424242', {:month => 9, :year => 15})

    @options = {
      :order_id => '2',
      :billing_address => address,
      :description => 'Store Purchase'
    }
  end

  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    assert_equal 'Approved', response.message
  end
<commit_msg>SecurePayAU: Add a remote test for doing a purchase with a custom credit card class<commit_after>require 'test_helper'

class RemoteSecurePayAuTest < Test::Unit::TestCase

  class MyCreditCard
    include ActiveMerchant::Billing::CreditCardMethods
    include ActiveMerchant::Validateable
    attr_accessor :number, :month, :year, :first_name, :last_name, :verification_value, :type

    def verification_value?
      !@verification_value.blank?
    end
  end

  def setup
    @gateway = SecurePayAuGateway.new(fixtures(:secure_pay_au))

    @amount = 100
    @credit_card = credit_card('4242424242424242', {:month => 9, :year => 15})

    @options = {
      :order_id => '2',
      :billing_address => address,
      :description => 'Store Purchase'
    }
  end

  def test_successful_purchase
    assert response = @gateway.purchase(@amount, @credit_card, @options)
    assert_success response
    assert_equal 'Approved', response.message
  end

  def test_successful_purchase_with_custom_credit_card_class
    options = {
      :number => 4242424242424242,
      :month => 9,
      :year => Time.now.year + 1,
      :first_name => 'Longbob',
      :last_name => 'Longsen',
      :verification_value => '123',
      :type => 'visa'
    }
    credit_card = MyCreditCard.new(options)
    assert response = @gateway.purchase(@amount, credit_card, @options)
    assert_success response
    assert_equal 'Approved', response.message
  end

{'fraction_non_alphanumeric': 0.10908193484698914, 'fraction_numerical': 0.033070088845014806, 'mean_word_length': 3.7919621749408985, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 20, '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': '6031280', 'n_tokens_mistral': 704, 'n_tokens_neox': 635, 'n_words': 142}