Projet

Général

Profil

0001-dpark-use-only-unicode-strings-38130.patch

Benjamin Dauvergne, 16 janvier 2020 00:08

Télécharger (2,03 ko)

Voir les différences:

Subject: [PATCH] dpark: use only unicode strings (#38130)

 passerelle/contrib/dpark/models.py | 2 ++
 tests/test_dpark.py                | 9 +++++++++
 2 files changed, 11 insertions(+)
passerelle/contrib/dpark/models.py
14 14
# You should have received a copy of the GNU Affero General Public License
15 15
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
16 16

  
17
from __future__ import unicode_literals
18

  
17 19
import base64
18 20
import json
19 21

  
tests/test_dpark.py
78 78
        super(ReplyDataClass, self).__init__(**kwargs)
79 79

  
80 80

  
81
class WebFaultHavingLatin1(WebFault):
82
    pass
83

  
84

  
81 85
class MockedService(object):
82 86

  
83 87
    def __init__(self, success, error_class, replydata):
......
90 94
            raise self.error_class(mock.Mock(faulstring='Error %s raised' % self.error_class.__name__), None)
91 95
        elif self.error_class is TransportError:
92 96
            raise self.error_class('connection error occured', None)
97
        elif self.error_class is WebFaultHavingLatin1:
98
            raise WebFault(message=u'éêè')
93 99
        else:
94 100
            raise Exception('random error')
95 101

  
......
121 127
        client.return_value = get_client(error_class=Exception)
122 128
        resp = app.get('/dpark/test/ping/')
123 129
        assert 'Error: random error' in resp.json['err_desc']
130
        client.return_value = get_client(error_class=WebFaultHavingLatin1)
131
        resp = app.get('/dpark/test/ping/')
132
        assert u'ServiceError: éêè' in resp.json['err_desc']
124 133

  
125 134

  
126 135
def test_ping(dpark, app):
127
-