Beispiel #1
0
    def test_get_success(self):
        """
        On success, returns Result(xml_template)
        """
        # Act
        result = SoapService._get_xml_template(
            settings.XML_TEMPLATES['prospect_create']['template'])

        # Assert
        self.assertTrue(result.success)
        self.assertTrue(result.data)
        self.assertFalse(result.message)
Beispiel #2
0
    def test_errors_handled_gracefully(self, mock_logger: mock.MagicMock):
        """
        On failure, error is caught, logged, and returns Result - success false
        """
        # Act
        result = SoapService._get_xml_template('bad_url')

        # Assert
        mock_logger.assert_called_once_with(
            "Unable to get xml template, error: [Errno 2] No such file or directory: 'bad_url'"
        )
        self.assertFalse(result.success)
        self.assertFalse(result.data)
        self.assertTrue(result.message)