コード例 #1
0
 def test_missing_password_raises(self):
     """
     Test that the Asana hook raises an exception if password not provided in connection.
     :return: None
     """
     with patch.object(AsanaHook,
                       "get_connection",
                       return_value=Connection(conn_type="asana")):
         hook = AsanaHook()
     with self.assertRaises(ValueError):
         hook.get_conn()
コード例 #2
0
 def test_asana_client_retrieved(self):
     """
     Test that we successfully retrieve an Asana client given a Connection with complete information.
     :return: None
     """
     with patch.object(AsanaHook,
                       "get_connection",
                       return_value=Connection(conn_type="asana",
                                               password="******")):
         hook = AsanaHook()
     client = hook.get_conn()
     self.assertEqual(type(client), Client)