~ubuntu-branches/ubuntu/precise/zonecheck/precise

« back to all changes in this revision

Viewing changes to test/mail.rb

  • Committer: Bazaar Package Importer
  • Author(s): Sebastien Delafond
  • Date: 2009-10-10 11:40:59 UTC
  • mto: This revision was merged to the branch mainline in revision 6.
  • Revision ID: james.westby@ubuntu.com-20091010114059-tnpi531yvdr5329q
Tags: upstream-2.0.4+cvs20081105
ImportĀ upstreamĀ versionĀ 2.0.4+cvs20081105

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
# ZCTEST 1.0
2
 
# $Id: mail.rb,v 1.36 2004/02/19 14:20:42 sdalu Exp $
 
2
# $Id: mail.rb,v 1.37 2004/12/02 09:06:11 bortzmeyer Exp $
3
3
 
4
4
5
5
# CONTACT     : zonecheck@nic.fr
6
6
# AUTHOR      : Stephane D'Alu <sdalu@nic.fr>
7
7
#
8
8
# CREATED     : 2002/09/25 19:14:21
9
 
# REVISION    : $Revision: 1.36 $ 
10
 
# DATE        : $Date: 2004/02/19 14:20:42 $
 
9
# REVISION    : $Revision: 1.37 $ 
 
10
# DATE        : $Date: 2004/12/02 09:06:11 $
11
11
#
12
12
# CONTRIBUTORS: (see also CREDITS file)
13
13
#
37
37
#       due to bestresolverip not correctly implemented
38
38
#
39
39
 
 
40
require 'timeout'
40
41
require 'framework'
41
42
require 'mail'
42
43
 
57
58
            @fake_from = const('fake_mail_from')
58
59
            @fake_user = const('fake_mail_user')
59
60
            @fake_host = const('fake_mail_host')
 
61
            @timeout_open    = const('smtp:open:timeout').to_i
 
62
            @timeout_session = const('smtp:session:timeout').to_i
60
63
        end
61
64
 
62
65
        #-- Shortcuts -----------------------------------------------
81
84
 
82
85
            # Execute test on mailhost
83
86
            mrelay = ZCMail::new(mdom, mip.to_s, dbgio)
84
 
            mrelay.open(CONNECTION_TIMEOUT)
 
87
            mrelay.open(@timeout_open)
85
88
            begin
 
89
              Timeout::timeout(@timeout_session) {
86
90
                mrelay.banner
87
91
                mrelay.helo(@fake_host)
88
92
                mrelay.fake_info(@fake_user, @fake_dest, @fake_from)
89
93
                yield mrelay
 
94
                mrelay.quit
 
95
              }
90
96
            ensure
91
 
                mrelay.quit
92
97
                mrelay.close
93
98
            end
94
99
        end