From 53221703f16bb18531288995b2af8ec9c84dd5d2 Mon Sep 17 00:00:00 2001 From: Wille Marcel Date: Fri, 29 Jun 2018 17:56:55 -0300 Subject: [PATCH 1/3] fix error when posting changeset comments with special chars --- osmchadjango/changeset/tasks.py | 2 +- osmchadjango/changeset/tests/test_tasks.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/osmchadjango/changeset/tasks.py b/osmchadjango/changeset/tasks.py index b6b59ec4..3f462697 100644 --- a/osmchadjango/changeset/tasks.py +++ b/osmchadjango/changeset/tasks.py @@ -120,7 +120,7 @@ def post_comment(self, message=None): """Post comment to changeset.""" response = self.client.post( self.url, - data='text={}'.format(message) + data='text={}'.format(message).encode("utf-8") ) if response.status_code == 200: print( diff --git a/osmchadjango/changeset/tests/test_tasks.py b/osmchadjango/changeset/tests/test_tasks.py index 9e02870d..cef263d7 100644 --- a/osmchadjango/changeset/tests/test_tasks.py +++ b/osmchadjango/changeset/tests/test_tasks.py @@ -114,6 +114,6 @@ class MockRequest(): mock_oauth_client.assert_called_with( 'POST', 'https://api.openstreetmap.org/api/0.6/changeset/123456/comment/', - data='text=Reviewed in OSMCha and set as GOOD!', + data=b'text=Reviewed in OSMCha and set as GOOD!', json=None ) From 47685b46fc23ec4687ac685ee87440ede1411398 Mon Sep 17 00:00:00 2001 From: Wille Marcel Date: Fri, 29 Jun 2018 18:20:45 -0300 Subject: [PATCH 2/3] continue fixing the errors --- osmchadjango/changeset/tests/test_comment_views.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/osmchadjango/changeset/tests/test_comment_views.py b/osmchadjango/changeset/tests/test_comment_views.py index cb732e30..82d3551a 100644 --- a/osmchadjango/changeset/tests/test_comment_views.py +++ b/osmchadjango/changeset/tests/test_comment_views.py @@ -74,7 +74,7 @@ class MockResponse(): 'https://api.openstreetmap.org/api/0.6/changeset/{}/comment/'.format( self.harmful_changeset.id ), - data='text={}'.format(message), + data='text={}'.format(message).encode('utf-8'), json=None ) @@ -104,7 +104,7 @@ class MockResponse(): 'https://api.openstreetmap.org/api/0.6/changeset/{}/comment/'.format( self.good_changeset.id ), - data='text={}'.format(message), + data='text={}'.format(message).encode('utf-8'), json=None ) @@ -118,7 +118,7 @@ def test_comment_unreviewed_changeset(self, mock_oauth_client): class MockResponse(): status_code = 200 mock_oauth_client.return_value = MockResponse - + self.client.login(username=self.user.username, password='password') comment = {'comment': 'Hello! Do you know this area?'} message = """Hello! Do you know this area? @@ -135,7 +135,7 @@ class MockResponse(): 'https://api.openstreetmap.org/api/0.6/changeset/{}/comment/'.format( self.changeset.id ), - data='text={}'.format(message), + data='text={}'.format(message).encode('utf-8'), json=None ) From e09bc553d0bc78b26a6c264f9de74b11b136eb41 Mon Sep 17 00:00:00 2001 From: Wille Marcel Date: Fri, 29 Jun 2018 18:30:12 -0300 Subject: [PATCH 3/3] update changelog --- CHANGELOG.rst | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/CHANGELOG.rst b/CHANGELOG.rst index e6b82ffe..d21e9beb 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -3,6 +3,14 @@ Change Log Log of changes since the 2.0 version +[3.0.4] - 2018-06-29 + +- Fix error in changeset comments when it has special characters + +[3.0.3] - 2018-06-18 + +- Update osmcha lib version to 0.4.8 + [3.0.2] - 2018-06-05 - Update Django version to 2.0.6