Ejemplo n.º 1
0
    def test_sets_self_client_on_success(self, zeep_client):
        """
        On success, returns Result(client)
        """
        # Arrange
        zeep_client.return_value = 'test'

        # Act
        result = SoapService._establish_client()

        # Assert
        self.assertTrue(result.success)
        self.assertEqual(result.data, 'test')
Ejemplo n.º 2
0
    def test_errors_handled_gracefully(self, zeep_client: mock.MagicMock,
                                       mock_logger: mock.MagicMock):
        """
        On failure, error is caught, logged, and returns Result - success false
        """
        # Arrange
        zeep_client.side_effect = Exception()

        # Act
        result = SoapService._establish_client()

        # Assert
        mock_logger.assert_called_once_with(
            'Unable to create soap client from wsdl file, error: ')
        self.assertTrue(result.message)
        self.assertFalse(result.data)
        self.assertFalse(result.success)