carterdte_smtp_filter 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +42 -0
- data/Rakefile +9 -0
- data/bin/carterdte_smtp_filter +66 -0
- data/carterdte_smtp_filter.gemspec +33 -0
- data/lib/carterdte_smtp_filter.rb +27 -0
- data/lib/carterdte_smtp_filter/api_client.rb +46 -0
- data/lib/carterdte_smtp_filter/config.rb +19 -0
- data/lib/carterdte_smtp_filter/dte.rb +90 -0
- data/lib/carterdte_smtp_filter/message.rb +65 -0
- data/lib/carterdte_smtp_filter/smtp_server.rb +33 -0
- data/lib/carterdte_smtp_filter/version.rb +3 -0
- data/o-ri/bundle +23 -0
- data/o-ri/bundler +23 -0
- data/test/fake_api.rb +69 -0
- data/test/fixtures/acuse.xml +108 -0
- data/test/fixtures/config.yml +13 -0
- data/test/fixtures/email_with_attachment_no_dte.eml +33 -0
- data/test/fixtures/envio_dte_33.xml +238 -0
- data/test/fixtures/guia_despacho.xml +222 -0
- data/test/fixtures/invalid_dte.xml +4 -0
- data/test/fixtures/mail.tmp +11 -0
- data/test/fixtures/mail_with_dte.eml +269 -0
- data/test/fixtures/mail_with_multiple_attachments.eml +283 -0
- data/test/fixtures/recepcion_dte_33.xml +200 -0
- data/test/fixtures/resultado_revision_sii.xml +17 -0
- data/test/test_api_client.rb +43 -0
- data/test/test_config.rb +20 -0
- data/test/test_dte.rb +79 -0
- data/test/test_helper.rb +277 -0
- data/test/test_message.rb +67 -0
- data/test/test_smtp_server.rb +42 -0
- metadata +252 -0
@@ -0,0 +1,42 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class TestSmtpServer < Minitest::Test
|
4
|
+
|
5
|
+
def setup
|
6
|
+
CarterdteSmtpFilter::Config.parse("./test/fixtures/config.yml")
|
7
|
+
@api_host = CarterdteSmtpFilter::Config::api_host
|
8
|
+
@api_url = "http://#{@api_host}"
|
9
|
+
stub_request(:any, /#{@api_host}/).to_rack(FakeApi)
|
10
|
+
@server = CarterdteSmtpFilter::SmtpServer.new()
|
11
|
+
@server.start
|
12
|
+
@return_stmp = ReturnSmtp.new()
|
13
|
+
@return_stmp.start
|
14
|
+
end
|
15
|
+
|
16
|
+
def teardown
|
17
|
+
@server.shutdown
|
18
|
+
sleep 2 unless @server.connections == 0
|
19
|
+
@server.stop
|
20
|
+
@return_stmp.shutdown
|
21
|
+
@return_stmp.stop
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_carterdte_smtp_filter_should_accept_mail
|
25
|
+
mail = Enviacorreo.new(port: CarterdteSmtpFilter::Config::bind_port)
|
26
|
+
assert(mail.send, "Failure message.")
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_should_return_email_to_postfix
|
30
|
+
mail = Enviacorreo.new(port: CarterdteSmtpFilter::Config::bind_port)
|
31
|
+
mail.send
|
32
|
+
return_email = Mail.read "./test/tmp/returnmail"
|
33
|
+
assert_equal("DTE", return_email.subject)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_should_accept_email_with_attachments
|
37
|
+
xml_file = "./test/fixtures/envio_dte_33.xml"
|
38
|
+
mail = Enviacorreo.new(port: CarterdteSmtpFilter::Config::bind_port, subject: "DTE Attachment", attachment_path: xml_file)
|
39
|
+
assert(mail.send, "Failure message.")
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,252 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: carterdte_smtp_filter
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patricio Bruna
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: mail
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '2.6'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '2.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: midi-smtp-server
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: xml-simple
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.1'
|
48
|
+
type: :runtime
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.1'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rest-client
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '1.7'
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '1.7'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: bundler
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.6'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.6'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '10.4'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '10.4'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '2.12'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '2.12'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: guard-minitest
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2.4'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '2.4'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: minitest-reporters
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: sinatra
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '1.4'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '1.4'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webmock
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '1.20'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '1.20'
|
167
|
+
description: Description - Postfix SMTP Filter to parse DTE files to CarterDTE Platform
|
168
|
+
email:
|
169
|
+
- pbruna@gmail.com
|
170
|
+
executables:
|
171
|
+
- carterdte_smtp_filter
|
172
|
+
extensions: []
|
173
|
+
extra_rdoc_files: []
|
174
|
+
files:
|
175
|
+
- ".gitignore"
|
176
|
+
- Gemfile
|
177
|
+
- LICENSE.txt
|
178
|
+
- README.md
|
179
|
+
- Rakefile
|
180
|
+
- bin/carterdte_smtp_filter
|
181
|
+
- carterdte_smtp_filter.gemspec
|
182
|
+
- lib/carterdte_smtp_filter.rb
|
183
|
+
- lib/carterdte_smtp_filter/api_client.rb
|
184
|
+
- lib/carterdte_smtp_filter/config.rb
|
185
|
+
- lib/carterdte_smtp_filter/dte.rb
|
186
|
+
- lib/carterdte_smtp_filter/message.rb
|
187
|
+
- lib/carterdte_smtp_filter/smtp_server.rb
|
188
|
+
- lib/carterdte_smtp_filter/version.rb
|
189
|
+
- o-ri/bundle
|
190
|
+
- o-ri/bundler
|
191
|
+
- test/fake_api.rb
|
192
|
+
- test/fixtures/acuse.xml
|
193
|
+
- test/fixtures/config.yml
|
194
|
+
- test/fixtures/email_with_attachment_no_dte.eml
|
195
|
+
- test/fixtures/envio_dte_33.xml
|
196
|
+
- test/fixtures/guia_despacho.xml
|
197
|
+
- test/fixtures/invalid_dte.xml
|
198
|
+
- test/fixtures/mail.tmp
|
199
|
+
- test/fixtures/mail_with_dte.eml
|
200
|
+
- test/fixtures/mail_with_multiple_attachments.eml
|
201
|
+
- test/fixtures/recepcion_dte_33.xml
|
202
|
+
- test/fixtures/resultado_revision_sii.xml
|
203
|
+
- test/test_api_client.rb
|
204
|
+
- test/test_config.rb
|
205
|
+
- test/test_dte.rb
|
206
|
+
- test/test_helper.rb
|
207
|
+
- test/test_message.rb
|
208
|
+
- test/test_smtp_server.rb
|
209
|
+
homepage: https://github.com/ZBoxApp/carterdte_smtp_filter
|
210
|
+
licenses:
|
211
|
+
- MIT
|
212
|
+
metadata: {}
|
213
|
+
post_install_message:
|
214
|
+
rdoc_options: []
|
215
|
+
require_paths:
|
216
|
+
- lib
|
217
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
218
|
+
requirements:
|
219
|
+
- - ">="
|
220
|
+
- !ruby/object:Gem::Version
|
221
|
+
version: '0'
|
222
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
223
|
+
requirements:
|
224
|
+
- - ">="
|
225
|
+
- !ruby/object:Gem::Version
|
226
|
+
version: '0'
|
227
|
+
requirements: []
|
228
|
+
rubyforge_project:
|
229
|
+
rubygems_version: 2.2.2
|
230
|
+
signing_key:
|
231
|
+
specification_version: 4
|
232
|
+
summary: Postfix SMTP Filter to parse DTE files to CarterDTE Platform
|
233
|
+
test_files:
|
234
|
+
- test/fake_api.rb
|
235
|
+
- test/fixtures/acuse.xml
|
236
|
+
- test/fixtures/config.yml
|
237
|
+
- test/fixtures/email_with_attachment_no_dte.eml
|
238
|
+
- test/fixtures/envio_dte_33.xml
|
239
|
+
- test/fixtures/guia_despacho.xml
|
240
|
+
- test/fixtures/invalid_dte.xml
|
241
|
+
- test/fixtures/mail.tmp
|
242
|
+
- test/fixtures/mail_with_dte.eml
|
243
|
+
- test/fixtures/mail_with_multiple_attachments.eml
|
244
|
+
- test/fixtures/recepcion_dte_33.xml
|
245
|
+
- test/fixtures/resultado_revision_sii.xml
|
246
|
+
- test/test_api_client.rb
|
247
|
+
- test/test_config.rb
|
248
|
+
- test/test_dte.rb
|
249
|
+
- test/test_helper.rb
|
250
|
+
- test/test_message.rb
|
251
|
+
- test/test_smtp_server.rb
|
252
|
+
has_rdoc:
|