You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/04/21 23:42:28 UTC

[GitHub] [airflow] mik-laj edited a comment on issue #8505: Add more precise tests for AirflowVersion

mik-laj edited a comment on issue #8505:
URL: https://github.com/apache/airflow/pull/8505#issuecomment-617467054


   We can create context  - `catch_jinja_params()` (similar to `count_queries`, `contextlib.redirect_stdout(io.StringIO())` ) that will help us introduce these assertions into current tests. Thanks to this, we will still have assertions for the HTML code, but also more precise for the Jinja params only.
   ```python
   class TestVersionView(TestBase):
       def test_version(self):
           with catch_jinja_params() as jinja_params:
               resp = self.client.get('version', data=dict(
                   username='test',
                   password='test'
               ), follow_redirects=True)
               self.check_content_in_response('Version Info', resp)
   
           self.assertEqual(jinja_params.template_name, 'airflow/version.html')
           self.assertEqual(jinja_params.params, dict(
               airflow_version=version.version,
               git_version=mock.ANY,
               scheduler_job=mock.ANY,
               title='Version Info'
           ))
   ```
   However, I only wanted to present the general concept in this PR.
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org