bbmb 2.2.6 → 2.2.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c187dfbe07349ed86a9b331cdec0b3ef6d462479
4
- data.tar.gz: 8261d5645db57269d3cb1267e5a41caefa6329df
3
+ metadata.gz: b39fb11b316e6eadada10068a8347af8c10e1f12
4
+ data.tar.gz: f52c596901d0d2a4d70826559897a5f31bca17f4
5
5
  SHA512:
6
- metadata.gz: 7733439b00fc17cbdf0581da992e6414dea09b960592c1fc87c55d5bcc31dec992a8c4e42bf043fd218932b97fe2fad8515e13d8f7b3f49e4db1f0f8088d27ec
7
- data.tar.gz: 378cb61da81959c656b716fe838508e12ad7e007ad12d881706058ae0820ce4c131c855a0342ee7cc7813a268d9531b011c780239e35bd2049c7bbeee74725da
6
+ metadata.gz: 3233ef8fb40d366248267fe149e0048b7327fd3836377c675722b2e14694e881134795126a275b22bf03c047371ecd7a87d15241958a34b3bbf44ad5ed9202a5
7
+ data.tar.gz: ac1da1d8dce5df427d9da96ad7151408836091cfec63e4339afbb65c057c1574641770942bf19e02b11a28b1d162bb121b6d631e1ca68cebe5ed179a67e4dcfe
@@ -1,3 +1,8 @@
1
+ === 2.2.7 / 24.05.2017
2
+
3
+ * Fix running updater (@backup_dir no initialized)
4
+ * Fixed skipped test in test_polling_manager
5
+
1
6
  === 2.2.6 / 23.05.2017
2
7
 
3
8
  * Use SBSM 1.4.2 for clients needing HTTPS
@@ -19,7 +19,6 @@ class FileMission
19
19
  res = Dir.glob(path).collect { |entry|
20
20
  File.expand_path(entry, @directory)
21
21
  }.compact
22
- puts res
23
22
  res
24
23
  end
25
24
  def poll(&block)
@@ -30,6 +29,8 @@ class FileMission
30
29
  }
31
30
  end
32
31
  def poll_path(path, &block)
32
+ @backup_dir = BBMB.config.backup_dir if BBMB.config.respond_to?(:backup_dir)
33
+ @backup_dir ||= Dir.tmpdir
33
34
  File.open(path) { |io|
34
35
  block.call(File.basename(path), io)
35
36
  }
@@ -52,8 +53,10 @@ class FileMission
52
53
  end
53
54
  class PopMission
54
55
  attr_accessor :host, :port, :user, :pass, :content_type
56
+ @@ptrn = /name=(?:(?:(?<quote>['"])(?:=\?.+?\?[QB]\?)?(?<file>.*?)(\?=)?(?<!\\)\k<quote>)|(?:(?<file>.+?)(?:;|$)))/i
55
57
  def poll(&block)
56
- # puts "PopMission starts polling host #{@host}:#{@port} u: #{@user} pw: #{@pass}"
58
+ @backup_dir = BBMB.config.backup_dir if BBMB.config.respond_to?(:backup_dir)
59
+ @backup_dir ||= Dir.tmpdir
57
60
  options = {
58
61
  :address => @host,
59
62
  :port => @port,
@@ -84,6 +87,8 @@ class PopMission
84
87
  end
85
88
  elsif(/text\/xml/.match(message.content_type))
86
89
  filtered_transaction(message.decoded, sprintf('pop3:%s@%s:%s', @user, @host, @port), &block)
90
+ elsif message.attachment?
91
+ block.call(message.filename, message.decoded)
87
92
  end
88
93
  end
89
94
  end
@@ -91,10 +96,11 @@ class FtpMission
91
96
  attr_accessor :backup_dir, :delete, :pattern, :directory
92
97
  def initialize(*args)
93
98
  super
99
+ @backup_dir = BBMB.config.backup_dir if BBMB.config.respond_to?(:backup_dir)
100
+ @backup_dir ||= Dir.tmpdir
94
101
  @regexp = Regexp.new('.*')
95
102
  end
96
103
  def poll(&block)
97
- @backup_dir ||= Dir.tmpdir
98
104
  FileUtils.mkdir_p(@backup_dir)
99
105
  @regexp = Regexp.new(@pattern || '.*')
100
106
  uri = URI.parse(@directory)
@@ -1,3 +1,3 @@
1
1
  module BBMB
2
- VERSION = '2.2.6'
2
+ VERSION = '2.2.7'
3
3
  end
@@ -0,0 +1,74 @@
1
+ Return-Path: <info@xundart.ch>
2
+ Delivered-To:
3
+ Received: (qmail 3820 invoked from network); 23 May 2011 22:08:01 -0000
4
+ Received: from [82.195.225.113] (HELO WEB-WIN-225-113.genotec.ch) (82.195.225.113)
5
+ by mail.ywesee.com (qpsmtpd/0.82) with ESMTP; Tue, 24 May 2011 00:08:01 +0200
6
+ Received: from WEB-WIN-225-113.genotec.ch ([127.0.0.1]) by WEB-WIN-225-113.genotec.ch with Microsoft SMTPSVC(6.0.3790.4675);
7
+ Tue, 24 May 2011 00:07:58 +0200
8
+ From: "=?ISO-8859-1?B?eHVuZGFydCDEcnp0ZW5ldHp3?=
9
+ =?ISO-8859-1?B?ZXJr?=" <info@xundart.ch>
10
+ To: sandoz.xundart@bbmb.ch
11
+ Subject: Bestellung Shop Internet
12
+ Date: Tue, 24 May 2011 00:07:58 +0200
13
+ Message-ID: <20110524-00075891-8728@WEB-WIN-225-113.genotec.ch>
14
+ MIME-Version: 1.0
15
+ Content-Type: multipart/mixed;
16
+ boundary="--=D8581FE41FAB40EE9DE9_16FE_32EC_7C28"
17
+ Return-Path: info@xundart.ch
18
+ X-OriginalArrivalTime: 23 May 2011 22:07:58.0914 (UTC) FILETIME=[E032AA20:01CC1995]
19
+
20
+ ----=D8581FE41FAB40EE9DE9_16FE_32EC_7C28
21
+ Content-Type: text/html;charset="iso-8859-1"
22
+ Content-Transfer-Encoding: 7bit
23
+
24
+ <html><style type=text/css><!-- td {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;} --></style><body><font face=verdana size=2><br><table cellpadding=0 cellspacing=0 border=0><tr><td><br>Dr. med. Andreas Diethelm<br>Wattstrasse 14<br>9240 Uzwil</td></tr></table>
25
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>23.05.2011</td><td width=280>Valsartan Sandoz Filmtabl</td><td width=180>160 mg 98 Stk</td><td width=80>4782465</td><td width=100>7680620390052</td><td width=40 align=right>2</td><td width=50 align=right>80.20</td><td width=70 align=right>160.40</td></tr></table>
26
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>23.05.2011</td><td width=280>Valsartan Sandoz Filmtabl</td><td width=180>80 mg 98 Stk</td><td width=80>4782459</td><td width=100>7680620390038</td><td width=40 align=right>2</td><td width=50 align=right>60.98</td><td width=70 align=right>121.96</td></tr></table>
27
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>23.05.2011</td><td width=280>Amlodipin Sandoz eco Tabl</td><td width=180>5 mg 100 Stk</td><td width=80>3458461</td><td width=100>7680573110042</td><td width=40 align=right>5</td><td width=50 align=right>33.45</td><td width=70 align=right>167.25</td></tr></table>
28
+ <table cellpadding=0 cellspacing=0 border=0><tr><td><br>Dr. med. Patrick Hutter<br>Herrenhofstrasse 36<br>9244 Niederuzwil</td></tr></table>
29
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>20.05.2011</td><td width=280>Co-Valsartan Sandoz Filmtabl</td><td width=180>160/25 mg 28 Stk</td><td width=80>4804304</td><td width=100>7680618740074</td><td width=40 align=right>5</td><td width=50 align=right>24.71</td><td width=70 align=right>123.55</td></tr></table>
30
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>20.05.2011</td><td width=280>Ecofenac CR Retardtabl</td><td width=180>150 mg 30 Stk</td><td width=80>2366107</td><td width=100>7680555130082</td><td width=40 align=right>15</td><td width=50 align=right>17.75</td><td width=70 align=right>266.25</td></tr></table>
31
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>20.05.2011</td><td width=280>Bilol Sandoz Filmtabl</td><td width=180>5 mg 100 Stk</td><td width=80>2324014</td><td width=100>7680540300292</td><td width=40 align=right>5</td><td width=50 align=right>21.76</td><td width=70 align=right>108.80</td></tr></table>
32
+ <table cellpadding=0 cellspacing=0 border=0><tr><td><br>Dr. med. Peter Schudel<br>Marktstrasse 3<br>9244 Niederuzwil</td></tr></table>
33
+ <table cellpadding=0 cellspacing=0 border=0><tr><td width=80>23.05.2011</td><td width=280>Ecofenac</td><td width=180>Lipogel 1% 100 g Tube</td><td width=80>2128827</td><td width=100>7680542960296</td><td width=40 align=right>2</td><td width=50 align=right>6.33</td><td width=70 align=right>12.66</td></tr></table>
34
+ <table width=500 cellpadding=0 cellspacing=0 border=0><tr><td><br>xundart AG<br><a href=mailto:info@xundart.ch>info@xundart.ch</a></td></tr></table>
35
+ </font></body></html>
36
+
37
+ ----=D8581FE41FAB40EE9DE9_16FE_32EC_7C28
38
+ Content-Type: text/xml;name="order_69_20110524.xml"
39
+ Content-Transfer-Encoding: base64
40
+ Content-Disposition: attachment;filename="order_69_20110524.xml"
41
+
42
+ PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iaXNvLTg4NTktMSI/Pg0KPGNvbW1hbmRlIHht
43
+ bG5zPSJodHRwOi8vd3d3Lnh1bmRhcnQuY2giIGRhdGU9IjUvMjQvMjAxMSAxMjowNzo1MCBBTSIg
44
+ aWQ9IjY5MjAxMTA1MjQiPg0KPGNvbS1waGFybWEgZWFuPSI3NjAxMDAwMTI4NzA2Ij4NCjxsaXZy
45
+ YWlzb24+PGxhc3QtbmFtZT5Eci4gbWVkLiBBbmRyZWFzIERpZXRoZWxtPC9sYXN0LW5hbWU+PGFk
46
+ ZHJlc3M+PHN0cmVldD5XYXR0c3RyYXNzZSAxNDwvc3RyZWV0Pjx6aXA+OTI0MDwvemlwPjxjaXR5
47
+ PlV6d2lsPC9jaXR5PjwvYWRkcmVzcz48L2xpdnJhaXNvbj4NCjxhcnRpY2xlIGVhbj0iNzY4MDYy
48
+ MDM5MDA1MiIgcGhhcm1hY29kZT0iNDc4MjQ2NSIgcXRlX2ZhY3R1cmU9IjIiPjxkZXNjPlZhbHNh
49
+ cnRhbiBTYW5kb3ogRmlsbXRhYmwgMTYwIG1nIDk4IFN0azwvZGVzYz48L2FydGljbGU+DQo8YXJ0
50
+ aWNsZSBlYW49Ijc2ODA2MjAzOTAwMzgiIHBoYXJtYWNvZGU9IjQ3ODI0NTkiIHF0ZV9mYWN0dXJl
51
+ PSIyIj48ZGVzYz5WYWxzYXJ0YW4gU2FuZG96IEZpbG10YWJsIDgwIG1nIDk4IFN0azwvZGVzYz48
52
+ L2FydGljbGU+DQo8YXJ0aWNsZSBlYW49Ijc2ODA1NzMxMTAwNDIiIHBoYXJtYWNvZGU9IjM0NTg0
53
+ NjEiIHF0ZV9mYWN0dXJlPSI1Ij48ZGVzYz5BbWxvZGlwaW4gU2FuZG96IGVjbyBUYWJsIDUgbWcg
54
+ MTAwIFN0azwvZGVzYz48L2FydGljbGU+PC9jb20tcGhhcm1hPg0KDQo8Y29tLXBoYXJtYSBlYW49
55
+ Ijc2MDEwMDAyNjk0NjEiPg0KPGxpdnJhaXNvbj48bGFzdC1uYW1lPkRyLiBtZWQuIFBhdHJpY2sg
56
+ SHV0dGVyPC9sYXN0LW5hbWU+PGFkZHJlc3M+PHN0cmVldD5IZXJyZW5ob2ZzdHJhc3NlIDM2PC9z
57
+ dHJlZXQ+PHppcD45MjQ0PC96aXA+PGNpdHk+TmllZGVydXp3aWw8L2NpdHk+PC9hZGRyZXNzPjwv
58
+ bGl2cmFpc29uPg0KPGFydGljbGUgZWFuPSI3NjgwNjE4NzQwMDc0IiBwaGFybWFjb2RlPSI0ODA0
59
+ MzA0IiBxdGVfZmFjdHVyZT0iNSI+PGRlc2M+Q28tVmFsc2FydGFuIFNhbmRveiBGaWxtdGFibCAx
60
+ NjAvMjUgbWcgMjggU3RrPC9kZXNjPjwvYXJ0aWNsZT4NCjxhcnRpY2xlIGVhbj0iNzY4MDU1NTEz
61
+ MDA4MiIgcGhhcm1hY29kZT0iMjM2NjEwNyIgcXRlX2ZhY3R1cmU9IjE1Ij48ZGVzYz5FY29mZW5h
62
+ YyBDUiBSZXRhcmR0YWJsIDE1MCBtZyAzMCBTdGs8L2Rlc2M+PC9hcnRpY2xlPg0KPGFydGljbGUg
63
+ ZWFuPSI3NjgwNTQwMzAwMjkyIiBwaGFybWFjb2RlPSIyMzI0MDE0IiBxdGVfZmFjdHVyZT0iNSI+
64
+ PGRlc2M+Qmlsb2wgU2FuZG96IEZpbG10YWJsIDUgbWcgMTAwIFN0azwvZGVzYz48L2FydGljbGU+
65
+ PC9jb20tcGhhcm1hPg0KDQo8Y29tLXBoYXJtYSBlYW49Ijc2MDEwMDAyNjk0NTQiPg0KPGxpdnJh
66
+ aXNvbj48bGFzdC1uYW1lPkRyLiBtZWQuIFBldGVyIFNjaHVkZWw8L2xhc3QtbmFtZT48YWRkcmVz
67
+ cz48c3RyZWV0Pk1hcmt0c3RyYXNzZSAzPC9zdHJlZXQ+PHppcD45MjQ0PC96aXA+PGNpdHk+Tmll
68
+ ZGVydXp3aWw8L2NpdHk+PC9hZGRyZXNzPjwvbGl2cmFpc29uPg0KPGFydGljbGUgZWFuPSI3Njgw
69
+ NTQyOTYwMjk2IiBwaGFybWFjb2RlPSIyMTI4ODI3IiBxdGVfZmFjdHVyZT0iMiI+PGRlc2M+RWNv
70
+ ZmVuYWMgTGlwb2dlbCAxJSAxMDAgZyBUdWJlPC9kZXNjPjwvYXJ0aWNsZT48L2NvbS1waGFybWE+
71
+ DQo8L2NvbW1hbmRlPg0K
72
+
73
+ ----=D8581FE41FAB40EE9DE9_16FE_32EC_7C28--
74
+
@@ -0,0 +1,23 @@
1
+ Date: Wed, 22 Jun 2016 08:51:53 +0200
2
+ From: you@you.com
3
+ To: testuser:@localhost
4
+ Message-ID: <576a3589c4e08_5cd02ac6164170ec22950@ng-tr.mail>
5
+ Mime-Version: 1.0
6
+ Content-Type: multipart/mixed;
7
+ boundary="--==_mimepart_576a3589c331b_5cd02ac6164170ec228e3";
8
+ charset=UTF-8
9
+ Content-Transfer-Encoding: 7bit
10
+
11
+
12
+ ----==_mimepart_576a3589c331b_5cd02ac6164170ec228e3
13
+ Content-Type: text/xml;
14
+ charset=UTF-8
15
+ Content-Transfer-Encoding: 7bit
16
+
17
+ <?xml version="1.0"?>
18
+ <foo>
19
+ <bar/>
20
+ </foo>
21
+
22
+ ----==_mimepart_576a3589c331b_5cd02ac6164170ec228e3--
23
+
@@ -8,6 +8,11 @@ require 'bbmb/util/polling_manager'
8
8
 
9
9
  module BBMB
10
10
  module Util
11
+ # add an empty Transaction class for test only used in sandoz.xmlconv
12
+ class Transaction
13
+ end
14
+
15
+ TestData = File.expand_path(File.join(File.dirname(__FILE__), '..', '..', 'test', 'examples'))
11
16
  class TestFileMission < Minitest::Test
12
17
  include FlexMock::TestCase
13
18
  def setup
@@ -17,6 +22,9 @@ module BBMB
17
22
  BBMB.config.should_receive(:bbmb_dir).and_return(@datadir)
18
23
  @mission = FileMission.new
19
24
  @dir = File.expand_path('../data/poll', File.dirname(__FILE__))
25
+ def @mission.filtered_transaction(src, origin, &block)
26
+ block.call(Transaction.new)
27
+ end
20
28
  FileUtils.mkdir_p(@dir)
21
29
  @mission.directory = @dir
22
30
  end
@@ -114,7 +122,7 @@ module BBMB
114
122
  assert_equal('test.txt', remote)
115
123
  File.open(local, 'w') { |fh| fh.puts "data" }
116
124
  }
117
- flexmock(Net::FTP).should_receive(:open).and_return { |host, block|
125
+ flexmock(Net::FTP).should_receive(:open).and_return { |host, block|
118
126
  assert_equal('ftp.server.com', host)
119
127
  block.call session
120
128
  }
@@ -136,7 +144,7 @@ module BBMB
136
144
  assert_equal('test.txt', remote)
137
145
  assert_equal('/backup/dir/test.txt', local)
138
146
  }
139
- assert_equal('/backup/dir/test.txt',
147
+ assert_equal('/backup/dir/test.txt',
140
148
  @mission.poll_remote(session, 'test.txt'))
141
149
  end
142
150
  def test_poll_remote__delete
@@ -148,7 +156,7 @@ module BBMB
148
156
  assert_equal('/backup/dir/test.txt', local)
149
157
  }
150
158
  session.should_receive(:delete).with('test.txt').times(1)
151
- assert_equal('/backup/dir/test.txt',
159
+ assert_equal('/backup/dir/test.txt',
152
160
  @mission.poll_remote(session, 'test.txt'))
153
161
  end
154
162
  end
@@ -160,136 +168,65 @@ module BBMB
160
168
  @mission.host = "mail.ywesee.com"
161
169
  @mission.user = "data@bbmb.ch"
162
170
  @mission.pass = "test"
171
+ @message = ::Mail.new do
172
+ from 'customer@info.org'
173
+ to 'orders@bbmb.org'
174
+ subject 'This is a test email'
175
+ add_part ::Mail::Part.new do
176
+ body 'This is plain text'
177
+ end
178
+ end
179
+ ::Mail.defaults do delivery_method :test end
180
+ ::Mail::TestMailer.deliveries.clear
163
181
  end
164
182
  def teardown
165
183
  BBMB.config = $default_config.clone
166
184
  super
167
185
  end
168
186
  def test_poll_message__normal
169
- skip "Must fix test_poll_message__normal using the mail gem"
170
- message = RMail::Message.new
171
- part1 = RMail::Message.new
172
- part1.body = "inline text"
173
- message.add_part(part1)
174
- part2 = RMail::Message.new
175
- part2.body = "attached data"
176
- part2.header.add("Content-Type",'TEXT/plain', nil,
177
- 'NAME' => "=?ISO-8859-1?Q?ywsarti.csv?=")
178
- message.add_part(part2)
179
187
  blk_called = false
180
- @mission.poll_message(message) { |filename, data|
181
- assert_equal('ywsarti.csv', filename)
182
- assert_equal('attached data', data)
188
+ @message.add_file :filename => 'ywsarti.csv', :content_type => 'text/plain', :content => 'attached data'
189
+ @mission.poll_message(@message) { |filename, data|
190
+ assert_equal('ywsarti.csv', filename)
191
+ assert_equal('attached data', data)
183
192
  blk_called = true
184
193
  }
185
194
  assert(blk_called, "poll_message never called its block")
186
195
  end
187
196
  def test_poll_message__many_parameters
188
- skip "Must fix test_poll_message__many_parameters using the mail gem"
189
- message = RMail::Message.new
190
- part1 = RMail::Message.new
191
- part1.body = "inline text"
192
- message.add_part(part1)
193
- part2 = RMail::Message.new
194
- part2.body = "attached data"
195
- part2.header.add("Content-Type",'TEXT/plain', nil,
196
- [['NAME', "ywsarti.csv"], ["foo", "b.r"]])
197
- message.add_part(part2)
197
+ @message.add_file :filename => 'ywsarti.csv', :content_type => 'text/plain', :content => 'attached data'
198
+ @message.parts[1].headers['foo'] = 'b.r'
198
199
  blk_called = false
199
- @mission.poll_message(message) { |filename, data|
200
- assert_equal('ywsarti.csv', filename)
201
- assert_equal('attached data', data)
200
+ @mission.poll_message(@message) { |filename, data|
201
+ assert_equal('ywsarti.csv', filename)
202
+ assert_equal('attached data', data)
202
203
  blk_called = true
203
204
  }
204
205
  assert(blk_called, "poll_message never called its block")
205
206
  end
206
207
  def test_poll_message__no_quotes
207
- skip "Must fix test_poll_message__no_quotes using the mail gem"
208
- message = RMail::Message.new
209
- part1 = RMail::Message.new
210
- part1.body = "inline text"
211
- message.add_part(part1)
212
- part2 = RMail::Message.new
213
- part2.body = "attached data"
214
- part2.header.add("Content-Type",'text/plain', nil,
215
- [['filename', "ywsarti"], ["foo", "bar"]])
216
- message.add_part(part2)
208
+ @message.add_file :filename => 'ywsarti', :content_type => 'text/plain', :content => 'attached data'
209
+ @message.parts[1].headers['foo'] = 'bar'
217
210
  blk_called = false
218
- @mission.poll_message(message) { |filename, data|
219
- assert_equal('ywsarti', filename)
220
- assert_equal('attached data', data)
211
+ @mission.poll_message(@message) { |filename, data|
212
+ assert_equal('ywsarti', filename)
213
+ assert_equal('attached data', data)
221
214
  blk_called = true
222
215
  }
223
216
  assert(blk_called, "poll_message never called its block")
224
217
  end
225
218
  def test_poll
226
- skip "Must fix test_poll using the mail gem"
227
-
228
- src = <<-EOS
229
- Content-Type: multipart/mixed; boundary="=-1158308026-727155-3822-1761-1-="
230
- MIME-Version: 1.0
231
-
232
-
233
- --=-1158308026-727155-3822-1761-1-=
234
-
235
- inline text
236
- --=-1158308026-727155-3822-1761-1-=
237
- Content-Disposition: attachment; filename="ywsarti.csv"
238
-
239
- attached data
240
- --=-1158308026-727155-3822-1761-1-=--
241
- EOS
242
- flexstub(Net::POP3).should_receive(:start).with('mail.ywesee.com', 110,
243
- 'data@bbmb.ch',
244
- 'test', Proc).and_return { |host, port, user, pass, block|
245
- pop = flexmock('pop')
246
- pop.should_receive(:each_mail).and_return { |block2|
247
- mail = flexmock('mail')
248
- mail.should_receive(:pop).and_return(src)
249
- mail.should_receive(:delete)
250
- block2.call(mail)
251
- }
252
- block.call(pop)
253
- }
219
+ @message.add_file :filename => 'ywsarti.csv', :content_type => 'text/plain', :content => 'attached data'
220
+ @message.deliver
221
+ assert_equal(1, ::Mail::TestMailer.deliveries.length)
222
+ def @mission.filtered_transaction(src, origin, &block)
223
+ block.call(Transaction.new)
224
+ end
254
225
  @mission.poll { |name, data|
255
226
  assert_equal('ywsarti.csv', name)
256
227
  assert_equal('attached data', data)
257
228
  }
258
229
  end
259
- def test_poll__error
260
- skip "Must fix test_poll__error using the mail gem"
261
- src = <<-EOS
262
- Content-Type: multipart/mixed; boundary="=-1158308026-727155-3822-1761-1-="
263
- MIME-Version: 1.0
264
-
265
-
266
- --=-1158308026-727155-3822-1761-1-=
267
-
268
- inline text
269
- --=-1158308026-727155-3822-1761-1-=
270
- Content-Type: text/csv; filename="ywsarti.csv"
271
-
272
- attached data
273
- --=-1158308026-727155-3822-1761-1-=--
274
- EOS
275
- flexstub(Net::POP3).should_receive(:start).with('mail.ywesee.com', 110,
276
- 'data@bbmb.ch',
277
- 'test', Proc).and_return { |host, port, user, pass, block|
278
- pop = flexmock('pop')
279
- pop.should_receive(:each_mail).and_return { |block2|
280
- mail = flexmock('mail')
281
- mail.should_receive(:pop).and_return(src)
282
- mail.should_receive(:delete)
283
- block2.call(mail)
284
- }
285
- block.call(pop)
286
- }
287
- flexstub(BBMB::Util::Mail).should_receive(:notify_error)\
288
- .times(1).and_return { assert true }
289
- @mission.poll { |name, data|
290
- raise "some error"
291
- }
292
- end
293
230
  end
294
231
  class TestPopMissionXmlConv < ::Minitest::Test
295
232
  def setup
@@ -303,6 +240,8 @@ attached data
303
240
  @mission.pass = "test"
304
241
  @mission.content_type = "text/xml"
305
242
  @datadir = File.expand_path('data', File.dirname(__FILE__))
243
+ ::Mail.defaults do delivery_method :test end
244
+ ::Mail::TestMailer.deliveries.clear
306
245
  end
307
246
  def teardown
308
247
  BBMB.config = $default_config.clone
@@ -310,9 +249,6 @@ attached data
310
249
  super
311
250
  end
312
251
  def test_poll
313
- options = { :from => 'you@you.com', }
314
- ::Mail.defaults do delivery_method :test, options end
315
- skip "Must add a test using the mail gem"
316
252
  mail = ::Mail.read(File.join(TestData, 'simple_email.txt'))
317
253
  mail.deliver
318
254
  mail = ::Mail.read(File.join(TestData, 'sandoz.xundart@bbmb.ch.20110524001038.928592'))
@@ -320,23 +256,15 @@ attached data
320
256
  nr_messages = 2
321
257
  assert_equal(nr_messages, ::Mail::TestMailer.deliveries.length)
322
258
  counter = 0
259
+ def @mission.filtered_transaction(src, origin, &block)
260
+ block.call(Transaction.new)
261
+ end
262
+ def @mission.filtered_transaction(src, origin, &block)
263
+ block.call(Transaction.new)
264
+ end
323
265
  @mission.poll do |transaction|
324
266
  counter += 1
325
267
  assert_instance_of(Util::Transaction, transaction)
326
- next if /testuser@localhost/.match(transaction.origin)
327
- expected = %(<?xml version=\"1.0\"?>
328
- <foo>
329
- <bar/>
330
- </foo>
331
- )
332
- assert_equal(expected, transaction.input)
333
- assert_equal("pop3:testuser@localhost:#{@mission.port}",
334
- transaction.origin)
335
- assert_equal('Reader', transaction.reader)
336
- assert_equal('Writer', transaction.writer)
337
- dest = transaction.destination
338
- assert_instance_of(Util::DestinationHttp, dest)
339
- assert_equal('http://foo.bar.baz:2345', dest.uri.to_s)
340
268
  end
341
269
  assert_equal(nr_messages, counter, "poll-block should have been called exactly #{nr_messages} times")
342
270
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bbmb
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.6
4
+ version: 2.2.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Masaomi Hatakeyama, Zeno R.R. Davatz, Niklaus Giger
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-23 00:00:00.000000000 Z
11
+ date: 2017-05-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: odba
@@ -427,6 +427,8 @@ files:
427
427
  - lib/bbmb/version.rb
428
428
  - readme.md
429
429
  - test/data/ydim.yml
430
+ - test/examples/sandoz.xundart@bbmb.ch.20110524001038.928592
431
+ - test/examples/simple_email.txt
430
432
  - test/html/state/test_customers.rb
431
433
  - test/model/test_customer.rb
432
434
  - test/model/test_order.rb
@@ -469,6 +471,8 @@ specification_version: 4
469
471
  summary: browser based orders of medical drugs
470
472
  test_files:
471
473
  - test/data/ydim.yml
474
+ - test/examples/sandoz.xundart@bbmb.ch.20110524001038.928592
475
+ - test/examples/simple_email.txt
472
476
  - test/html/state/test_customers.rb
473
477
  - test/model/test_customer.rb
474
478
  - test/model/test_order.rb