view · edit · sidebar · attach · print · history

Index>

20140530-mail-receivers-in-oddb-yml-2

Summary

  • replace list of email receipents by configuration data in etc/oddb.yaml

Commits

Index

Keep in Mind
  • Fix dojo error http://www.sitepen.com/blog/2012/10/31/debugging-dojo-common-error-messages/#forgot-dom-ready
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • One unit-test for searchbar fails and might be a clue why searching does not work correctly.
  • Added two skip in test/test_plugin/rss.rb. Why does the mocking not work there anymore?

---

replace list of email receipents by configuration data in etc/oddb.yaml

Fixing the last unit-test error test/test_util/ipn.rb.

Fixed .travis.yml to show an error, when the unit-tests fail.

Creating the unit-tests in test/test_util/mail.rb to define the interface to the definition of email-receiveivers. We want to see something like this in etc/oddb.yml

mail_recipients:
  - :email: customer@company.com
    :lists:
      - oddb
      - oddb2csv
  - :email: customer2@another_company.com
    :lists:
      - oddb2csv
  - :email: ywesee_test@ywesee.com
    :lists:
      - test
      - admin
      - oddb
      - ipn
      - oddb2csv
      # all lists at oddb

Thinking about whether to define a list of ID of good known receiver list either in etc/oddb.yml or src/util/mail.rb.

In etc/oddb.yml we could define it like

mailling_list_ids:
  - test
  - ipn
  - oddb2csv
or as constants in src/util/mail.rb. In Ruby 2.0 I would use a statement like enumerator = %w(test ipn oddb2csv).each. But as we are still on Ruby 1.9. We could use
class Mail
  Test = 0
  Ipn  = 1
  Oddb2csv = 2

Migrating from Ruby 1.9 to 2.0 with enumeration would mean replacing Capitalized-name to lowercase names.

Therefore I personally prefer a definition in oddb.yml. Creating a a new fail test/data/oddb_mailing_list_test.yml (in source code repository) with sample entries for unit tests.

Changing the method API to use an list instead of recipients like this

    def Util.send_mail(recipients, mail_subject, mail_body, override_from = nil, parts = {})
    def Util.send_mail_with_attachments(subject, body, attachments)
    def Util.send_mail(list_id, mail_subject, mail_body, override_from = nil, parts = {})
    def Util.send_mail_with_attachments(list_id, subject, body, attachments)

and adding a helper method def Util.use_mailing_list_configuration(path_to_yml = 'etc/oddb.yml') to enable switching between different e-mail configuration. Unit tests work now.

Looking in all places to generate a correct definition of all receivers in etc/oddb.yml. Also replacing all recipients by a new list_id. Found that we have a lot of configuration info also in src/util/oddbconfig.rb. Is everything still used?

After looking at all unit-tests (specially ipn) I remarked that I must change the semantics of the list_id for the Util.send_mail to accept an array which must include a list_id and optionally one or more recipients, e.g. the actual email user who gets the invoice.

Adapted the receivers in the following files

  • src/util/log.rb (using new id 'log')
  • src/util/oddbconfig.rb Removed definitions
  • etc/testenvironment[1|2].rb Removed definitions
  • src/state/suggest_address.rb new id 'suggest_address'
  • src/util/ipn.rb: new id 'ipn'
  • src/plugin/invoicer.rb: new id 'ipn'
  • ext/export/src/generics_xls.rb: new_id 'generics_xls'
  • ext/export/lugin/csv_export.rb: new_id 'oddb'
  • ext/export/lugin/csv_export.rb: new_id 'oddb_dat'
  • ext/export/lugin/csv_export.rb: new_id 'oddb_dat_extended'
  • src/plugin/bsv_xml.rb. Reworked and adde Anrede for each receiver to be included

Remarked that including SimpleCov into the unit test makes some tests fail because coverage is too low and/or simplecov thinks it has dropped a little bit. I should probably rework all unit tests to include test/helpers.rb and configure SimpleCov there correctly for all.

view · edit · sidebar · attach · print · history
Page last modified on May 31, 2014, at 07:25 AM