You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2020/11/05 22:09:07 UTC
[allura] 03/04: [#8379] fix akismet tests
This is an automated email from the ASF dual-hosted git repository.
brondsem pushed a commit to branch db/8379
in repository https://gitbox.apache.org/repos/asf/allura.git
commit 571210772c5d97fa8e34201e8a3f814fcb8cfdb6
Author: Dave Brondsema <da...@brondsema.net>
AuthorDate: Thu Nov 5 16:04:18 2020 -0500
[#8379] fix akismet tests
---
Allura/allura/tests/unit/spam/test_akismet.py | 44 +++++++++++++--------------
1 file changed, 22 insertions(+), 22 deletions(-)
diff --git a/Allura/allura/tests/unit/spam/test_akismet.py b/Allura/allura/tests/unit/spam/test_akismet.py
index 670c98f..7dec31d 100644
--- a/Allura/allura/tests/unit/spam/test_akismet.py
+++ b/Allura/allura/tests/unit/spam/test_akismet.py
@@ -67,10 +67,10 @@ class TestAkismet(unittest.TestCase):
self.content = 'spåm text'
self.expected_data = dict(
comment_content=self.content.encode('utf8'),
- comment_type='comment',
- user_ip='some ip',
- user_agent='some browser',
- referrer='some url')
+ comment_type=b'comment',
+ user_ip=b'some ip',
+ user_agent=b'some browser',
+ referrer=b'some url')
@mock.patch('allura.lib.spam.akismetfilter.c')
@mock.patch('allura.lib.spam.akismetfilter.request')
@@ -89,7 +89,7 @@ class TestAkismet(unittest.TestCase):
request.remote_addr = 'some ip'
c.user = None
self.akismet.check(self.content, content_type='some content type')
- self.expected_data['comment_type'] = 'some content type'
+ self.expected_data['comment_type'] = b'some content type'
self.akismet.service.comment_check.assert_called_once_with(**self.expected_data)
@mock.patch('allura.lib.spam.akismetfilter.c')
@@ -100,9 +100,9 @@ class TestAkismet(unittest.TestCase):
c.user = None
self.akismet.check(self.content, artifact=self.fake_artifact)
expected_data = self.expected_data
- expected_data['permalink'] = 'http://localhost/artifact-url'
- expected_data['comment_date_gmt'] = '2019-05-17T00:00:00'
- expected_data['comment_post_modified_gmt'] = '2019-05-17T00:05:01'
+ expected_data['permalink'] = b'http://localhost/artifact-url'
+ expected_data['comment_date_gmt'] = b'2019-05-17T00:00:00'
+ expected_data['comment_post_modified_gmt'] = b'2019-05-17T00:05:01'
self.akismet.service.comment_check.assert_called_once_with(**expected_data)
@mock.patch('allura.lib.spam.akismetfilter.c')
@@ -114,7 +114,7 @@ class TestAkismet(unittest.TestCase):
self.akismet.check(self.content, user=self.fake_user)
expected_data = self.expected_data
expected_data.update(comment_author='Søme User'.encode('utf8'),
- comment_author_email='user@domain')
+ comment_author_email=b'user@domain')
self.akismet.service.comment_check.assert_called_once_with(**expected_data)
@mock.patch('allura.lib.spam.akismetfilter.c')
@@ -126,7 +126,7 @@ class TestAkismet(unittest.TestCase):
self.akismet.check(self.content)
expected_data = self.expected_data
expected_data.update(comment_author='Søme User'.encode('utf8'),
- comment_author_email='user@domain')
+ comment_author_email=b'user@domain')
self.akismet.service.comment_check.assert_called_once_with(**expected_data)
@mock.patch('allura.lib.spam.akismetfilter.c')
@@ -137,9 +137,9 @@ class TestAkismet(unittest.TestCase):
# no IP addr, UA, etc, since this isn't the original request
expected_data = dict(comment_content='spåm text'.encode('utf8'),
- comment_type='comment',
- user_ip='',
- user_agent='',
+ comment_type=b'comment',
+ user_ip=b'',
+ user_agent=b'',
)
self.akismet.service.submit_spam.assert_called_once_with(**expected_data)
@@ -151,9 +151,9 @@ class TestAkismet(unittest.TestCase):
# no IP addr, UA, etc, since this isn't the original request
expected_data = dict(comment_content='spåm text'.encode('utf8'),
- comment_type='comment',
- user_ip='',
- user_agent='',
+ comment_type=b'comment',
+ user_ip=b'',
+ user_agent=b'',
)
self.akismet.service.submit_ham.assert_called_once_with(**expected_data)
@@ -164,11 +164,11 @@ class TestAkismet(unittest.TestCase):
self.akismet.submit_ham(self.content, artifact=self.fake_artifact)
expected_data = dict(comment_content='spåm text'.encode('utf8'),
- comment_type='comment',
- user_ip='33.4.5.66',
- user_agent='',
- permalink='http://localhost/artifact-url',
- comment_date_gmt='2019-05-17T00:00:00',
- comment_post_modified_gmt='2019-05-17T00:05:01',
+ comment_type=b'comment',
+ user_ip=b'33.4.5.66',
+ user_agent=b'',
+ permalink=b'http://localhost/artifact-url',
+ comment_date_gmt=b'2019-05-17T00:00:00',
+ comment_post_modified_gmt=b'2019-05-17T00:05:01',
)
self.akismet.service.submit_ham.assert_called_once_with(**expected_data)