Roundup Tracker - Issues

Message7505

Author rouilj
Recipients marcus.priesch, rouilj, schlatterbeck
Date 2022-05-04.15:22:46
Message-id <1651677767.13.0.618307992606.issue2551184@roundup.psfhosted.org>
In-reply-to
Hi Marcus:

> the default in config.ini is to not translate rest and xmlrpc - so
> we need to change that before the test.

Correct. If you look at test/rest_common.py you can see code like:

   self.db.config['WEB_JWT_SECRET'] = secret

self.db.config['...'] is the config object used by the test. So in
this case we would set:

   self.db.config['WEB_TRANSLATE_REST"] = 'yes'
   
or
   self.db.config['WEB_TRANSLATE_XMLRPC'] = 'yes'
      
before calling the code that does the request. This can be changed on
the fly in tests not using the live server (test_liveserver.py). I
usually store the original value, change it and restore at the end of
the test. In most cases, each test generates a fresh db.config but I
have been bit by my config changes leaking into other tests.

I think the translation for rest can be verified using a test in
rest_common.py by setting the right config option and setting the
proper headers in self.headers in rest_common.py.

(For the live server we have to shut down and start the server with
the new config which can probably be done but.... Probably better to
have multiple live_serverN.py files that set the parameters we want in
SimpleTest::setup_class and just use the server for all the tests.)

> db_test_base.py:setupTracker ? or can this be done at a later stage
> ... sorry, i am not that deep in the testing stuff.

It can be done at the test level, not setup. I am not great at the
testing stuff either.  However we just reached 75% code coverage and I
don't want to slide back 8-).

> for mailgw i dont know if we would need to setup a detector that
> creates some i18n'd message ? or should it also send translated
> issue status ?

That's a good question. I looked for _( in mailgw.py to see what
strings are marked to be translated. It looks like:

  Emails to Roundup trackers must include a Subject: line!

is one such string. Sadly de.po doesn't have a transation for that
string 8-(. So I guess:

 1) translate that string for german and generate a .mo from
    locale/de.po
 2) craft a test case from existing tests n test_mailgw.py that
    is missing the Subject. Verify the error shows up in the result
    using self._get_mail().
 3) set self.db.config['MAILGW_LANGUAGE'] = 'de' and verify new
    translation shows up.

that should provide basic coverage.

For extra credit:

  test with self.db.config['MAILGW_LANGUAGE'] = "" and
    self.db.config['TRACKER_LANGUAGE'] = 'de'
    
(IIRC you fixed the code for this test to work right. Thanks.)
History
Date User Action Args
2022-05-04 15:22:47rouiljsetmessageid: <1651677767.13.0.618307992606.issue2551184@roundup.psfhosted.org>
2022-05-04 15:22:47rouiljsetrecipients: + rouilj, schlatterbeck, marcus.priesch
2022-05-04 15:22:47rouiljlinkissue2551184 messages
2022-05-04 15:22:46rouiljcreate