mail-sympa 1.2.0 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 80e5a9d1f11092aa68c5908670f85ef32334e279
4
- data.tar.gz: dce53c46cf3e526dc799d67c00215fab06ed1b0f
2
+ SHA256:
3
+ metadata.gz: 07f92c6b81efe0506caa2b1299e8c1cce2be291c3227f7988820a4f83ea5897b
4
+ data.tar.gz: 29cc076be53d88472dc07a07307c0a6c64c52dd00fb2f21cf0665bab45687bdf
5
5
  SHA512:
6
- metadata.gz: dc125416bcbace4986a3b7153ed16618c4db8b839a962173123a1be42c2373b3868d32fe42debba09bdacd47c77767eab7fa859e1f7d309c65eb5c7e303a0368
7
- data.tar.gz: 08616cb32a4e507e6737df0b89d65a1ad132818f10e4454de618e96739c5bbc65d845830f747a822002e4d7f6e9a381f7a6fe2d6e193afaeaaf3ea30fe665375
6
+ metadata.gz: a95d3859b2294d7e23c511736e4165bd7f6f66d9e8015d1413b58d6ef66088a73e8b55329a0f09d76e2c894717b442e03d318fb813286e2ae5e22fe4508ff2dc
7
+ data.tar.gz: 48b6759cd034938614dbe762b59e3c368ba5581bf9c4646bafb77ff5bb1ab5c0951326a235089a364957413800e7bb1fedc1097252e3e2aa4199c7ff7ecbcbe3
checksums.yaml.gz.sig ADDED
Binary file
data/CHANGES.md ADDED
@@ -0,0 +1,43 @@
1
+ ## 1.3.1 - 20-Nov-2026
2
+ * Fix the version, oops.
3
+
4
+ ## 1.3.0 - 19-Nov-2026
5
+ * Replaced soap4r-ruby1.9 with Savon 2.x and Nokogiri for SOAP communication.
6
+ * Structured SOAP values now return as hashes with symbol keys, such as
7
+ `:subject` and `:list_address`, instead of `SOAP::Mapping` objects.
8
+ * Login now normalizes email addresses, validates session cookies, and clears
9
+ an existing session when reauthentication fails.
10
+ * SOAP faults and transport failures now raise `Mail::Sympa::Error`, including
11
+ server fault details when available.
12
+ * Fixed the `am_i?` error message to include the invalid function name.
13
+ * Replaced the test-unit suite with RSpec and made `rake spec` the default task.
14
+ Removed the dbi-dbrc dependency and `.dbirc` test configuration.
15
+ * Added `rake docker:build` and `rake docker:spec` for self-contained integration
16
+ tests against real Sympa, including authentication and changes to server state.
17
+ * Updated gem build/install tasks, added RubyGems metadata, and standardized the
18
+ license identifier as `Artistic-2.0`.
19
+ * Converted documentation to Markdown, consolidated usage and testing details
20
+ in README.md, and updated the manifest.
21
+
22
+ ## 1.2.0 - 12-Mar-2016
23
+ * No longer supports Ruby 1.8, and made corresponding changes to code.
24
+ * Updated the Rakefile tasks. Now assumes Rubygems 2.x.
25
+ * Added a mail-sympa.rb file for convenience.
26
+ * Removed Gemfile.lock.
27
+
28
+ ## 1.1.0 - 19-Jul-2011
29
+ * Added the `authenticate_remote_app_and_run` method to run in trusted context
30
+ and support for Ruby 1.9+. Thanks go to Blair Christensen for patches.
31
+
32
+ ## 1.0.0 - 16-Jun-2011
33
+ * Added the `create_list` and `close_list` methods and corresponding tests. Thanks
34
+ go to Blair Christensen for both.
35
+ * Added 0.1.1 changes to this file that I forgot.
36
+ * Bumped the version to 1.0.0, as I have no more future plans for this library.
37
+
38
+ ## 0.1.1 - 17-Jan-2011
39
+ * Fixed two parser warnings caused by missing commas.
40
+ * Added a clean and default task to the Rakefile.
41
+
42
+ ## 0.1.0 - 13-Apr-2010
43
+ * Initial release
data/Gemfile CHANGED
@@ -1,9 +1,2 @@
1
- source 'http://rubygems.org'
2
- gem 'soap4r-ruby1.9'
3
-
4
- group :development, :test do
5
- gem 'test-unit'
6
- gem 'dbi-dbrc'
7
- end
8
-
9
- # vim: syntax=ruby
1
+ source 'https://rubygems.org'
2
+ gemspec
data/MANIFEST.md ADDED
@@ -0,0 +1,22 @@
1
+ * .dockerignore
2
+ * .github/FUNDING.yml
3
+ * .gitignore
4
+ * CHANGES.md
5
+ * Gemfile
6
+ * MANIFEST.md
7
+ * README.md
8
+ * Rakefile
9
+ * certs/djberg96_pub.pem
10
+ * docker/Dockerfile
11
+ * docker/run_specs.rb
12
+ * docker/seed_sympa.pl
13
+ * docker/test-apache.conf
14
+ * docker/test-sympa.conf
15
+ * docker/test-syslog.conf
16
+ * docker/test-topics.conf
17
+ * lib/mail-sympa.rb
18
+ * lib/mail/sympa.rb
19
+ * mail-sympa.gemspec
20
+ * spec/mail_sympa_spec.rb
21
+ * spec/soap_integration_spec.rb
22
+ * spec/spec_helper.rb
data/README.md ADDED
@@ -0,0 +1,190 @@
1
+ ## Description
2
+
3
+ The mail-sympa library is a Ruby interface for the Sympa mailing list management software.
4
+
5
+ ## Prerequisites
6
+
7
+ * Savon 2.x
8
+ * Nokogiri 1.x
9
+
10
+ ## Installation
11
+
12
+ ```sh
13
+ gem install mail-sympa
14
+ ```
15
+
16
+ ## Synopsis
17
+
18
+ ```ruby
19
+ require 'mail/sympa' # or require 'mail-sympa'
20
+
21
+ mail = Mail::Sympa.new(server, namespace)
22
+ mail.login(email, password)
23
+
24
+ # Enumerate over each list and inspect it
25
+ mail.lists.each do |list|
26
+ p list
27
+ end
28
+
29
+ # Add a user quietly
30
+ mail.add('foo@bar.com', 'some_list', 'Mr. Foo', true)
31
+ ```
32
+
33
+ ## Creating Lists
34
+
35
+ Supply a topic configured in the server's `topics.conf` when creating a list:
36
+
37
+ ```ruby
38
+ mail.create_list('some_list', 'Example list', 'discussion_list', 'Description', 'computing')
39
+ ```
40
+
41
+ ## SOAP Integration
42
+
43
+ The client uses Savon 2.x and Nokogiri. Its SOAP behavior is verified against
44
+ real Sympa 6.2.70 through the containerized suite below. The public method names
45
+ and aliases remain available.
46
+
47
+ * Authenticated operations use `authenticateAndRun` with a session cookie.
48
+ * Requests use Sympa's required `namespace#method` SOAPAction and encoded
49
+ parameter arrays.
50
+ * Trusted-application calls use `authenticateRemoteAppAndRun` with the same
51
+ array encoding.
52
+ * Responses decode native SOAP values, including empty and singleton arrays,
53
+ structs, and false booleans.
54
+ * Login validates the returned cookie, canonicalizes the email, and clears an
55
+ existing session when reauthentication fails.
56
+ * Server fault details and transport failures surface as `Mail::Sympa::Error`.
57
+
58
+ See the [Sympa SOAP/HTTP API](https://www.sympa.community/manual/customize/soap-api.html)
59
+ for the server's service contract.
60
+
61
+ ## Testing in Docker
62
+
63
+ Run from the repository root:
64
+
65
+ ```sh
66
+ rake docker:build
67
+ rake docker:spec
68
+ ```
69
+
70
+ The host needs Ruby, Rake, and a running Docker daemon. All application and test
71
+ dependencies are installed inside the image; no host `bundle install` is needed.
72
+
73
+ `docker:build` builds `mail-sympa-test` with Ruby 3.3 and Debian Bookworm's Sympa
74
+ 6.2.70 package, Apache/FastCGI, and SQLite. `docker:spec` first builds the image
75
+ (reusing cached dependency layers), then runs a disposable container with:
76
+
77
+ 1. A fresh SQLite database and Sympa list state.
78
+ 2. Two password-authenticated users, two lists, a subscriber, and a trusted SOAP application.
79
+ 3. The actual Sympa SOAP service and WWSympa WSDL endpoint served by Apache.
80
+ 4. The complete RSpec suite, with no excluded examples.
81
+
82
+ The runner prints the installed Sympa package version, waits up to 30 seconds
83
+ for HTTP readiness, and returns a failing status on provisioning, startup, or
84
+ spec failures. Startup and test failures print the HTTP server log and Sympa's
85
+ syslog. Docker removes the container afterward, including its database, lists,
86
+ and queued notifications.
87
+
88
+ The source is copied at build time, so each `docker:spec` run includes current
89
+ edits without writing gems or lockfiles into the checkout. No host ports,
90
+ persistent volumes, external database, web setup, or `~/.dbirc` are needed.
91
+ The test container runs with networking disabled; localhost remains available.
92
+ Mail delivery daemons are not started.
93
+
94
+ ### Runtime and Image Overrides
95
+
96
+ Docker is preferred; Podman is used if Docker is not installed. To select one
97
+ explicitly:
98
+
99
+ ```sh
100
+ CONTAINER_RUNTIME=podman rake docker:spec
101
+ ```
102
+
103
+ The selected runtime must already be running. Set `MAIL_SYMPA_IMAGE` to change
104
+ the tag used for both building and running:
105
+
106
+ ```sh
107
+ MAIL_SYMPA_IMAGE=mail-sympa-dev rake docker:build docker:spec
108
+ ```
109
+
110
+ After building, run selected examples or pass RSpec options:
111
+
112
+ ```sh
113
+ docker run --rm --network none mail-sympa-test spec/mail_sympa_spec.rb --seed 1234
114
+ ```
115
+
116
+ ### Fixtures and Configuration
117
+
118
+ The test domain is `sympa.test`; Apache listens on container-local port 8080.
119
+ The listmaster is `postmaster@sympa.test` and the second user is
120
+ `reader@example.test`, both with password `test`. The `testlist` list contains
121
+ the reader; `partners` starts empty. Both lists use topic `testlist/testlist`.
122
+ The trusted application is `mail-sympa-tests`, with password `test-app-password`
123
+ and permission to proxy `USER_EMAIL`. These credentials belong only to the
124
+ throwaway test environment.
125
+
126
+ The relevant setup is in [docker/test-sympa.conf](docker/test-sympa.conf),
127
+ [docker/test-apache.conf](docker/test-apache.conf),
128
+ [docker/test-topics.conf](docker/test-topics.conf), and
129
+ [docker/seed_sympa.pl](docker/seed_sympa.pl). SQLite keeps this SOAP integration
130
+ environment self-contained; see Sympa's
131
+ [SQLite setup instructions](https://www.sympa.community/manual/install/setup-database-sqlite.html).
132
+
133
+ ### Test Coverage and Results
134
+
135
+ Verified on 19 November 2026 using `rake docker:build` and `rake docker:spec`:
136
+
137
+ ```text
138
+ 88 examples, 0 failures
139
+ ```
140
+
141
+ No examples are excluded. Tests cover valid and invalid authentication,
142
+ sessions, list discovery and topic filters, SOAP arrays and structs, true and
143
+ false permissions, trusted-app credentials, subscriber changes, and list
144
+ creation and closure. Mutation tests verify the resulting server state as
145
+ well as return values.
146
+
147
+ These results cover the tested server version and SOAP operations. SMTP
148
+ delivery, other Sympa releases, other Ruby versions, and production database
149
+ deployments are outside this suite's scope.
150
+
151
+ ### Running Specs on the Host
152
+
153
+ To run specs against an equivalently provisioned real server, use
154
+ `bundle install` followed by `bundle exec rake spec`. Optional variables are
155
+ `SYMPA_ENDPOINT`, `SYMPA_WSDL_URL`, `SYMPA_TEST_USER`, and `SYMPA_TEST_PASSWORD`.
156
+ The server must contain the fixture lists, topic, reader, and trusted application
157
+ above: these tests change server state.
158
+
159
+ The retired SOAP simulator and its support files are preserved on the
160
+ `archive/mock-sympa` branch.
161
+
162
+ ## Acknowledgements
163
+
164
+ Thanks go to Blair Christensen for some nice patches for this library.
165
+
166
+ ## License
167
+
168
+ Artistic-2.0
169
+
170
+ ## Copyright
171
+
172
+ (C) 2010-2011 Daniel J. Berger, Mark Sallee, David Salisbury, Blair Christensen
173
+ All Rights Reserved
174
+
175
+ ## Warranty
176
+
177
+ This library is provided "as is" and without any express or
178
+ implied warranties, including, without limitation, the implied
179
+ warranties of merchantability and fitness for a particular purpose.
180
+
181
+ ## Notes
182
+
183
+ See http://www.sympa.org for details.
184
+
185
+ ## Authors
186
+
187
+ * Daniel Berger
188
+ * David Salisbury
189
+ * Mark Sallee
190
+ * Blair Christensen
data/Rakefile CHANGED
@@ -1,8 +1,30 @@
1
1
  require 'rake'
2
2
  require 'rake/clean'
3
- require 'rake/testtask'
4
3
 
5
- CLEAN.include("**/*.gem", "**/*.rbc")
4
+ CLEAN.include("**/*.gem", "**/*.rbc", "**/*.lock")
5
+
6
+ def container_runtime
7
+ return ENV['CONTAINER_RUNTIME'] unless ENV['CONTAINER_RUNTIME'].to_s.empty?
8
+
9
+ %w[docker podman].find do |runtime|
10
+ ENV.fetch('PATH', '').split(File::PATH_SEPARATOR).any? do |directory|
11
+ File.executable?(File.join(directory, runtime))
12
+ end
13
+ end || raise('Install Docker or Podman to run the containerized specs.')
14
+ end
15
+
16
+ namespace :docker do
17
+ desc 'Build the image containing Ruby, real Sympa, Apache, and SQLite'
18
+ task :build do
19
+ sh container_runtime, 'build', '-f', File.join(__dir__, 'docker/Dockerfile'),
20
+ '-t', ENV.fetch('MAIL_SYMPA_IMAGE', 'mail-sympa-test'), __dir__
21
+ end
22
+
23
+ desc 'Run RSpec against a freshly seeded real Sympa server in a disposable container'
24
+ task :spec => :build do
25
+ sh container_runtime, 'run', '--rm', '--network', 'none', ENV.fetch('MAIL_SYMPA_IMAGE', 'mail-sympa-test')
26
+ end
27
+ end
6
28
 
7
29
  namespace 'gem' do
8
30
  desc 'Remove any existing gem file'
@@ -11,22 +33,32 @@ namespace 'gem' do
11
33
  end
12
34
 
13
35
  desc 'Build the mail-sympa gem'
14
- task :build => [:clean] do
36
+ task :create => [:clean] do
15
37
  require 'rubygems/package'
16
- spec = eval(IO.read('mail-sympa.gemspec'))
17
- Gem::Package.build(spec, true)
38
+ spec = Gem::Specification.load('mail-sympa.gemspec')
39
+ spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem')
40
+ Gem::Package.build(spec)
18
41
  end
19
42
 
20
43
  desc 'Install the mail-sympa gem'
21
- task :install => [:build] do
44
+ task :install => [:create] do
22
45
  file = Dir["*.gem"].first
23
- sh "gem install #{file}"
46
+ sh "gem install -l #{file}"
24
47
  end
25
48
  end
26
49
 
27
- Rake::TestTask.new('test') do |t|
28
- t.warning = true
29
- t.verbose = true
50
+ begin
51
+ require 'rspec/core/rake_task'
52
+
53
+ RSpec::Core::RakeTask.new('spec') do |t|
54
+ t.rspec_opts = ['--color', '--format', 'documentation']
55
+ end
56
+
57
+ rescue LoadError
58
+ task :spec do
59
+ abort 'RSpec not available. Run rake docker:spec or install dependencies with bundle install.'
60
+ end
61
+
30
62
  end
31
63
 
32
- task :default => :test
64
+ task :default => :spec
@@ -0,0 +1,26 @@
1
+ -----BEGIN CERTIFICATE-----
2
+ MIIEcDCCAtigAwIBAgIBATANBgkqhkiG9w0BAQsFADA/MREwDwYDVQQDDAhkamJl
3
+ cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t
4
+ MB4XDTE4MDMxODE1MjIwN1oXDTI4MDMxNTE1MjIwN1owPzERMA8GA1UEAwwIZGpi
5
+ ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv
6
+ bTCCAaIwDQYJKoZIhvcNAQEBBQADggGPADCCAYoCggGBALgfaroVM6CI06cxr0/h
7
+ A+j+pc8fgpRgBVmHFaFunq28GPC3IvW7Nvc3Y8SnAW7pP1EQIbhlwRIaQzJ93/yj
8
+ u95KpkP7tA9erypnV7dpzBkzNlX14ACaFD/6pHoXoe2ltBxk3CCyyzx70mTqJpph
9
+ 75IB03ni9a8yqn8pmse+s83bFJOAqddSj009sGPcQO+QOWiNxqYv1n5EHcvj2ebO
10
+ 6hN7YTmhx7aSia4qL/quc4DlIaGMWoAhvML7u1fmo53CYxkKskfN8MOecq2vfEmL
11
+ iLu+SsVVEAufMDDFMXMJlvDsviolUSGMSNRTujkyCcJoXKYYxZSNtIiyd9etI0X3
12
+ ctu0uhrFyrMZXCedutvXNjUolD5r9KGBFSWH1R9u2I3n3SAyFF2yzv/7idQHLJJq
13
+ 74BMnx0FIq6fCpu5slAipvxZ3ZkZpEXZFr3cIBtO1gFvQWW7E/Y3ijliWJS1GQFq
14
+ 058qERadHGu1yu1dojmFRo6W2KZvY9al2yIlbkpDrD5MYQIDAQABo3cwdTAJBgNV
15
+ HRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUFZsMapgzJimzsbaBG2Tm8j5e
16
+ AzgwHQYDVR0RBBYwFIESZGpiZXJnOTZAZ21haWwuY29tMB0GA1UdEgQWMBSBEmRq
17
+ YmVyZzk2QGdtYWlsLmNvbTANBgkqhkiG9w0BAQsFAAOCAYEAW2tnYixXQtKxgGXq
18
+ /3iSWG2bLwvxS4go3srO+aRXZHrFUMlJ5W0mCxl03aazxxKTsVVpZD8QZxvK91OQ
19
+ h9zr9JBYqCLcCVbr8SkmYCi/laxIZxsNE5YI8cC8vvlLI7AMgSfPSnn/Epq1GjGY
20
+ 6L1iRcEDtanGCIvjqlCXO9+BmsnCfEVehqZkQHeYczA03tpOWb6pon2wzvMKSsKH
21
+ ks0ApVdstSLz1kzzAqem/uHdG9FyXdbTAwH1G4ZPv69sQAFAOCgAqYmdnzedsQtE
22
+ 1LQfaQrx0twO+CZJPcRLEESjq8ScQxWRRkfuh2VeR7cEU7L7KqT10mtUwrvw7APf
23
+ DYoeCY9KyjIBjQXfbj2ke5u1hZj94Fsq9FfbEQg8ygCgwThnmkTrrKEiMSs3alYR
24
+ ORVCZpRuCPpmC8qmqxUnARDArzucjaclkxjLWvCVHeFa9UP7K3Nl9oTjJNv+7/jM
25
+ WZs4eecIcUc4tKdHxcAJ0MO/Dkqq7hGaiHpwKY76wQ1+8xAh
26
+ -----END CERTIFICATE-----
data/docker/Dockerfile ADDED
@@ -0,0 +1,24 @@
1
+ FROM ruby:3.3-slim-bookworm
2
+
3
+ COPY docker/test-sympa.conf /etc/sympa/sympa/sympa.conf
4
+
5
+ RUN apt-get update \
6
+ && printf '#!/bin/sh\nexit 101\n' > /usr/sbin/policy-rc.d \
7
+ && chmod +x /usr/sbin/policy-rc.d \
8
+ && printf 'sympa sympa/dbconfig-install boolean false\nsympa sympa/hostname string sympa.test\nsympa sympa/listmaster string postmaster@sympa.test\n' | debconf-set-selections \
9
+ && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
10
+ build-essential sympa dbconfig-no-thanks apache2 libapache2-mod-fcgid \
11
+ libdbd-sqlite3-perl libsoap-lite-perl sqlite3 \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ WORKDIR /app
15
+
16
+ COPY Gemfile mail-sympa.gemspec ./
17
+ RUN bundle install
18
+
19
+ COPY . .
20
+ COPY docker/test-sympa.conf /etc/sympa/sympa/sympa.conf
21
+ COPY docker/test-topics.conf /etc/sympa/topics.conf
22
+ COPY docker/run_specs.rb /usr/local/bin/run_specs
23
+
24
+ ENTRYPOINT ["bundle", "exec", "ruby", "/usr/local/bin/run_specs"]
@@ -0,0 +1,66 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'rbconfig'
5
+ require 'tempfile'
6
+
7
+ # Every container gets its own SQLite database and list state. No mail daemons
8
+ # are started; SOAP operations run synchronously and notification mail is spooled.
9
+ abort 'Sympa package is missing' unless system('dpkg-query', '-W', 'sympa')
10
+ abort 'Sympa logging setup failed' unless system('rsyslogd', '-f', '/app/docker/test-syslog.conf', '-i', '/tmp/mail-sympa-syslog.pid')
11
+ abort 'Sympa database initialization failed' unless system('sympa', 'check')
12
+ abort 'Sympa fixture provisioning failed' unless system('perl', 'docker/seed_sympa.pl')
13
+ abort 'Sympa permissions setup failed' unless system('chown', '-R', 'sympa:sympa', '/var/lib/sympa', '/var/spool/sympa', '/etc/sympa')
14
+
15
+ server_log = Tempfile.new('mail-sympa-server')
16
+ server_pid = Process.spawn('/usr/sbin/apache2', '-f', '/app/docker/test-apache.conf', '-DFOREGROUND',
17
+ out: server_log, err: server_log)
18
+ status = 1
19
+
20
+ begin
21
+ deadline = Process.clock_gettime(Process::CLOCK_MONOTONIC) + 30
22
+ health = URI('http://localhost:8080/sympa/wsdl')
23
+
24
+ loop do
25
+ if Process.waitpid(server_pid, Process::WNOHANG)
26
+ server_pid = nil
27
+ raise 'Sympa HTTP server exited before becoming ready.'
28
+ end
29
+
30
+ begin
31
+ response = Net::HTTP.start(health.host, health.port, open_timeout: 1, read_timeout: 1) do |http|
32
+ http.get(health.request_uri)
33
+ end
34
+ break if response.is_a?(Net::HTTPSuccess) && response.body.include?('definitions')
35
+ rescue SystemCallError, Timeout::Error, EOFError
36
+ # Wait for the server to open its socket.
37
+ end
38
+
39
+ raise 'Sympa HTTP server was not ready within 30 seconds.' if Process.clock_gettime(Process::CLOCK_MONOTONIC) >= deadline
40
+
41
+ sleep 0.1
42
+ end
43
+
44
+ puts 'Sympa HTTP server ready. Running specs...'
45
+ system(RbConfig.ruby, '-S', 'rspec', '--format', 'documentation', *ARGV)
46
+ status = $?.exitstatus || 1
47
+ rescue StandardError => error
48
+ warn error.message
49
+ ensure
50
+ if server_pid
51
+ begin
52
+ Process.kill('TERM', server_pid)
53
+ rescue Errno::ESRCH
54
+ # The server may have exited while the specs were running.
55
+ end
56
+ Process.waitpid(server_pid)
57
+ end
58
+ unless status.zero?
59
+ server_log.rewind
60
+ warn "Sympa HTTP server log:\n#{server_log.read}"
61
+ warn "Sympa log:\n#{File.read('/var/log/mail-sympa.log')}" if File.file?('/var/log/mail-sympa.log')
62
+ end
63
+ server_log.close!
64
+ end
65
+
66
+ exit status
@@ -0,0 +1,60 @@
1
+ use strict;
2
+ use warnings;
3
+ use lib '/usr/share/sympa/lib';
4
+ use Conf;
5
+ use Digest::MD5 qw(md5_hex);
6
+ use File::Path qw(make_path);
7
+ use Sympa::List;
8
+ use Sympa::Log;
9
+ use Sympa::User;
10
+
11
+ Conf::load() or die "Cannot load Sympa configuration\n";
12
+ Sympa::Log->instance->openlog('LOCAL1', 'unix', service => 'test-seed');
13
+
14
+ for my $email ('postmaster@sympa.test', 'reader@example.test') {
15
+ Sympa::User->new($email, password => 'test', gecos => 'Integration user', lang => 'en_US')
16
+ or die "Cannot create user $email\n";
17
+ }
18
+
19
+ for my $name ('testlist', 'partners') {
20
+ my $directory = "/var/lib/sympa/list_data/$name";
21
+ make_path($directory);
22
+ open my $config, '>', "$directory/config" or die $!;
23
+ print {$config} <<"CONFIG";
24
+ subject Test list $name
25
+
26
+ status open
27
+
28
+ visibility noconceal
29
+
30
+ subscribe open
31
+
32
+ unsubscribe open
33
+
34
+ review owner
35
+
36
+ topics testlist/testlist
37
+
38
+
39
+ owner
40
+ email postmaster\@sympa.test
41
+ profile privileged
42
+
43
+ editor
44
+ email postmaster\@sympa.test
45
+
46
+ CONFIG
47
+ close $config or die $!;
48
+ my $list = Sympa::List->new($name, 'sympa.test') or die "Cannot load list $name\n";
49
+ if ($name eq 'testlist') {
50
+ $list->add_list_member({email => 'reader@example.test', gecos => 'Test reader', subscribed => 1})
51
+ or die "Cannot seed subscriber\n";
52
+ }
53
+ }
54
+
55
+ open my $trusted, '>', '/etc/sympa/trusted_applications.conf' or die $!;
56
+ print {$trusted} "trusted_application\n name mail-sympa-tests\n md5password ",
57
+ md5_hex('test-app-password'), "\n proxy_for_variables USER_EMAIL\n\n";
58
+ close $trusted or die $!;
59
+
60
+ print "Seeded real Sympa users, lists, and trusted application.\n";
@@ -0,0 +1,24 @@
1
+ ServerRoot /etc/apache2
2
+ ServerName localhost
3
+ PidFile /tmp/mail-sympa-apache.pid
4
+ DefaultRuntimeDir /var/run/apache2
5
+ Listen 127.0.0.1:8080
6
+
7
+ LoadModule mpm_event_module /usr/lib/apache2/modules/mod_mpm_event.so
8
+ LoadModule authz_core_module /usr/lib/apache2/modules/mod_authz_core.so
9
+ LoadModule alias_module /usr/lib/apache2/modules/mod_alias.so
10
+ LoadModule fcgid_module /usr/lib/apache2/modules/mod_fcgid.so
11
+
12
+ User sympa
13
+ Group sympa
14
+ ErrorLog /proc/self/fd/2
15
+ LogLevel warn
16
+ FcgidIPCDir /tmp/mail-sympa-fcgid
17
+
18
+ ScriptAlias /sympasoap /usr/lib/cgi-bin/sympa/sympa_soap_server.fcgi
19
+ ScriptAlias /sympa /usr/lib/cgi-bin/sympa/wwsympa.fcgi
20
+ <Directory /usr/lib/cgi-bin/sympa>
21
+ Options +ExecCGI
22
+ SetHandler fcgid-script
23
+ Require all granted
24
+ </Directory>
@@ -0,0 +1,11 @@
1
+ domain sympa.test
2
+ listmaster postmaster@sympa.test
3
+ db_type SQLite
4
+ db_name /var/lib/sympa/sympa.sqlite
5
+ home /var/lib/sympa/list_data
6
+ etc /etc/sympa
7
+ wwsympa_url http://localhost:8080/sympa
8
+ soap_url http://localhost:8080/sympasoap
9
+ cookie mail-sympa-integration-tests
10
+ create_list public_listmaster
11
+ aliases_program none
@@ -0,0 +1,2 @@
1
+ module(load="imuxsock")
2
+ *.* /var/log/mail-sympa.log
@@ -0,0 +1,5 @@
1
+ testlist
2
+ title Test lists
3
+
4
+ testlist/testlist
5
+ title Nested test lists