Sha256: 533e9cd7c26465069a8bc073f66b5d233ee517a0996be2fc7c962c825f03e649

Contents?: true

Size: 838 Bytes

Versions: 1

Compression:

Stored size: 838 Bytes

Contents

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

class PasswdTest < Test::Unit::TestCase

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

  def test_process_fails_pre
    @handler.expects(:update_account_password).returns(nil)
    assert_raise(Authpipe::AuthpipeException) do
      @handler.process("imap\tfoo\tabc\tdef")
    end
  end

  def test_process_passes_pre
    @handler.expects(:update_account_password).with(
      { :authservice => 'imap', :username => 'foo', :oldpasswd => 'abc', :newpasswd => 'def' }
    ).returns(@account)
    assert_equal @account.to_authpipe, @handler.process("imap\tfoo\tabc\tdef")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

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