Sha256: f67e8a1262c028a03278a70935116622c6b577fc343064bceee674a54e07c5f4

Contents?: true

Size: 1.5 KB

Versions: 1

Compression:

Stored size: 1.5 KB

Contents

#
# Testing OpenWFEru
#
# John Mettraux at openwfe.org
#
# Tue Jan  2 13:14:37 JST 2007
#

require 'test/unit'

require 'openwfe/workitem'
require 'openwfe/engine/engine'
require 'openwfe/expressions/raw_prog'
require 'openwfe/participants/participants'
require 'openwfe/participants/enoparticipants'
#require 'flowtestbase'

require 'rubygems'
require 'mailtrap'

include OpenWFE


class EnoTest < Test::Unit::TestCase

    #def setup
    #end

    #def teardown
    #end

    #
    # Test 0
    #

    class TestDefinition0 < ProcessDefinition
        email_notification_participant
    end

    def test_eno

        mailfile = "work/mailtrap.txt"

        FileUtils.mkdir "work" unless File.exist?("work")
        FileUtils.rm mailfile if File.exist?(mailfile)
        Thread.new do
            Mailtrap.new 'localhost', 2525, true, "work/mailtrap.txt"
        end

        engine = Engine.new

        eno = MailParticipant.new(
            :smtp_server => "localhost",
            :smtp_port => 2525,
            :from_address => "eno@outoftheblue.co.jp"
        ) do

            s = ""
            s << "Subject: test 0\n"
            s << "\n"
            s << "konnichiwa. #{Time.now.to_s}\n\n"

            s
        end

        engine.register_participant("email_notification_participant", eno)

        li = LaunchItem.new TestDefinition0

        li.email_target = 'john@localhost'

        fei = engine.launch li
        engine.wait_for fei

        assert_equal 1, OpenWFE.grep("konnichiwa", mailfile).size
    end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
openwferu-0.9.16 test/eno_test.rb