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/08/17 07:50:56 UTC
[GitHub] [airflow] turbaszek commented on a change in pull request #10353: Expand JenkinsJobTriggerOperator unit tests
turbaszek commented on a change in pull request #10353:
URL: https://github.com/apache/airflow/pull/10353#discussion_r471302621
##########
File path: tests/providers/jenkins/operators/test_jenkins_job_trigger.py
##########
@@ -20,15 +20,23 @@
import jenkins
import mock
+from parameterized import parameterized
from airflow.exceptions import AirflowException
from airflow.providers.jenkins.hooks.jenkins import JenkinsHook
from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator
+TEST_PARAMS = [
+ ({'a_param': 'blip', 'another_param': '42'},),
+ ('{"a_param": "blip", "another_param": "42"}',),
+ (['a_param', 'blip', 'another_param', '42'],),
+]
+
class TestJenkinsOperator(unittest.TestCase):
+ @parameterized.expand(TEST_PARAMS)
Review comment:
I personally prefer when the dict is placed in the decorator - no need to look for test cases :)
##########
File path: tests/providers/jenkins/operators/test_jenkins_job_trigger.py
##########
@@ -20,15 +20,23 @@
import jenkins
import mock
+from parameterized import parameterized
from airflow.exceptions import AirflowException
from airflow.providers.jenkins.hooks.jenkins import JenkinsHook
from airflow.providers.jenkins.operators.jenkins_job_trigger import JenkinsJobTriggerOperator
+TEST_PARAMS = [
+ ({'a_param': 'blip', 'another_param': '42'},),
+ ('{"a_param": "blip", "another_param": "42"}',),
+ (['a_param', 'blip', 'another_param', '42'],),
+]
+
class TestJenkinsOperator(unittest.TestCase):
+ @parameterized.expand(TEST_PARAMS)
@unittest.skipIf(mock is None, 'mock package not present')
- def test_execute(self):
+ def test_execute(self, the_parameters):
Review comment:
```suggestion
def test_execute(self, parameters):
```
----------------------------------------------------------------
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