module TestModuleML
Public Instance Methods
ml_setup()
click to toggle source
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 44 def ml_setup # setup quickml config if ! defined?($quickml_config) || $quickml_config.nil? config = Qwik::Config.new config[:logger] = QuickML::MockLogger.new config.update(Qwik::Config::DebugConfig) config.update(Qwik::Config::TestConfig) QuickML::ServerMemory.init_mutex(config) QuickML::ServerMemory.init_catalog(config) $quickml_config = config end @ml_config = $quickml_config dummy = @ml_config.logger.get_log # clear log @ml_dir = @ml_config.sites_dir.path+'test' @ml_dir.teardown @ml_catalog = @ml_config.catalog @ml_message_charset = 'iso-2022-jp' t_make_public(QuickML::Group, :site_post) end
ml_teardown()
click to toggle source
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 74 def ml_teardown @ml_dir.teardown if @ml_dir end
ok_log(e, range=nil)
click to toggle source
assert¶ ↑
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 124 def ok_log(e, range=nil) logs = @ml_config.logger.get_log logs = logs[range] if range return ok_eq(e, logs) if e.is_a?(Array) return ok_eq(e, logs.join("\n")) end
Also aliased as: ok
post_mail(group, &b)
click to toggle source
send_normal_mail(from)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 111 def send_normal_mail(from) sendmail(from, 'test@q.example.com', 'test') { 'test' } end
sendmail(from, to, subject, cc=nil) { || ... }
click to toggle source
session¶ ↑
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 79 def sendmail(from, to, subject, cc=nil) message = yield cc_line = '' cc_line = "Cc: #{cc}\n" if cc separator_line = '' separator_line = "\n" unless /\n\z/ =~ message contents = '' contents << "To: #{to}\n" contents << "From: #{from}\n" contents << "Subject: #{subject}\n" contents << cc_line contents << separator_line contents << message inputs = "HELO localhost MAIL FROM: #{from} RCPT TO: #{to} DATA #{contents} . QUIT " inputs = inputs.set_sourcecode_charset.to_mail_charset socket = QuickML::MockSocket.new(inputs) c = @ml_config session = QuickML::Session.new(c, c.logger, c.catalog, socket) session.start return socket.result end
setup()
click to toggle source
sm(sub, &b)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 119 def sm(sub, &b) sendmail('bob@example.net', 'test@q.example.com', sub, &b) end
teardown()
click to toggle source
unsubscribe(from)
click to toggle source
# File vendor/qwik/lib/qwik/test-module-ml.rb, line 115 def unsubscribe(from) sendmail(from, 'test@q.example.com', 'unsubscribe') { '' } end