示例#1
0
 def test_merge_create_task_parameters_specified_workspace(self):
     """
     Test that merge_create_task_parameters correctly merges the default and method parameters when we
     do not override the default workspace.
     :return: None
     """
     conn = Connection(conn_type="asana",
                       password="******",
                       extra='{"extra__asana__workspace": "1"}')
     with patch.object(AsanaHook, "get_connection", return_value=conn):
         hook = AsanaHook()
     expected_merged_params = {"name": "test", "workspace": "1"}
     self.assertEqual(
         expected_merged_params,
         hook._merge_create_task_parameters("test", {})  # pylint: disable=W0212
     )
示例#2
0
 def test_merge_create_task_parameters_specified_project_overrides_default_workspace(
         self):
     """
     Test that merge_create_task_parameters uses the method parameter project over the default workspace
     if it is available
     :return: None
     """
     conn = Connection(
         conn_type="asana",
         password="******",
         extra='{"extra__asana__workspace": "1"}',
     )
     with patch.object(AsanaHook, "get_connection", return_value=conn):
         hook = AsanaHook()
     expected_merged_params = {"name": "test", "projects": ["2"]}
     self.assertEqual(
         expected_merged_params,
         hook._merge_create_task_parameters("test", {"projects": ["2"]}),  # pylint: disable=W0212
     )