Sha256: 16f98434d96a698feff2382ac63acfb5497b821a8383d62cb78bca097af660b1

Contents?: true

Size: 869 Bytes

Versions: 1

Compression:

Stored size: 869 Bytes

Contents

require File.dirname(__FILE__) + '/../test_helper'

class PreTest < Test::Unit::TestCase

  def setup
    @handler = Authpipe::Pre.new
    @account = Authpipe::AccountData[:address => 'foo@example.com', :home => '/home/foo', :gid => 1024, :uid => 1024]
  end

  def test_process_calls_get_account_data
    pre = ". imap foo"
    @handler.expects(:get_account_data).with(
      :authservice => 'imap', :username => 'foo'
    ).returns(@account)
    @handler.process(pre)
  end

  def test_process_fails_pre
    @handler.expects(:get_account_data).returns(nil)
    assert_raises(Authpipe::AuthpipeException) do
      @handler.process(". imap foo")
    end
  end

  def test_process_passes_pre
    @handler.expects(:get_account_data).returns(@account)
    assert_nothing_raised do
      assert_equal @account.to_authpipe, @handler.process(". imap foo")
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mroch-authpipe-0.1.1 test/authpipe/pre_test.rb