示例#1
0
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))

        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(
            **{
                'main_url.return_value': 'artifact url',
                'project_id': ObjectId(),
                'ref': None,
            })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(USER_AGENT='some browser', REFERER='some url')
        self.content = u'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')
示例#2
0
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))
        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(**{
            'main_url.return_value': 'artifact url',
            'project_id': ObjectId(),
            'ref': None,
        })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(
            USER_AGENT='some browser',
            REFERER='some url')
        self.content = u'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')
示例#3
0
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({
            'spam.key': 'example',
            'base_url': 'http://localhost/'
        })

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            six.moves.urllib.parse.urlencode(kw.get('data', {}))

        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_spam = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_ham = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(
            **{
                'main_url.return_value':
                '/artifact-url',
                'project_id':
                ObjectId(),
                'ref':
                None,
                'timestamp':
                datetime(2019, 5, 17),
                'primary.return_value':
                mock.Mock(mod_date=datetime(2019, 5, 17, 0, 5, 1)),
                'get_version.return_value':
                mock.Mock(author=mock.Mock(logged_ip='33.4.5.66', )),
            })
        self.fake_user = mock.Mock(display_name='Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(USER_AGENT='some browser', REFERER='some url')
        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')
示例#4
0
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({'spam.key': 'example', 'base_url': 'http://localhost/'})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))
        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_spam = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_ham = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(**{
            'main_url.return_value': '/artifact-url',
            'project_id': ObjectId(),
            'ref': None,
            'timestamp': datetime(2019, 5, 17),
            'primary.return_value': mock.Mock(
                mod_date=datetime(2019, 5, 17, 0, 5, 1)
            ),
            'get_version.return_value': mock.Mock(
                author=mock.Mock(
                    logged_ip='33.4.5.66',
                )
            ),
        })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(
            USER_AGENT='some browser',
            REFERER='some url')
        self.content = u'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')
示例#5
0
class TestAkismet(unittest.TestCase):
    @mock.patch('allura.lib.spam.akismetfilter.akismet')
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))

        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(
            **{
                'main_url.return_value': 'artifact url',
                'project_id': ObjectId(),
                'ref': None,
            })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(USER_AGENT='some browser', REFERER='some url')
        self.content = u'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')

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.service.comment_check.side_effect({'side_effect': ''})
        self.akismet.check(self.content)
        self.akismet.service.comment_check.assert_called_once_with(
            self.content, data=self.expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_explicit_content_type(self, request, c):
        request.headers = self.fake_headers
        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.akismet.service.comment_check.assert_called_once_with(
            self.content, data=self.expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_artifact(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.check(self.content, artifact=self.fake_artifact)
        expected_data = self.expected_data
        expected_data['permalink'] = 'artifact url'
        self.akismet.service.comment_check.assert_called_once_with(
            self.content, data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.check(self.content, user=self.fake_user)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(
            self.content, data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_implicit_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = self.fake_user
        self.akismet.check(self.content)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(
            self.content, data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_spam(self, c):
        c.user = None

        self.akismet.submit_spam(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(
            comment_content=u'spåm text'.encode('utf8'),
            comment_type='comment',
        )
        self.akismet.service.submit_spam.assert_called_once_with(
            self.content, data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham(self, c):
        c.user = None

        self.akismet.submit_ham(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(
            comment_content=u'spåm text'.encode('utf8'),
            comment_type='comment',
        )
        self.akismet.service.submit_ham.assert_called_once_with(
            self.content, data=expected_data, build_data=False)
示例#6
0
class TestAkismet(unittest.TestCase):

    @mock.patch('allura.lib.spam.akismetfilter.akismet')
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))
        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(**{
            'main_url.return_value': 'artifact url',
            'project_id': ObjectId(),
            'ref': None,
        })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(
            USER_AGENT='some browser',
            REFERER='some url')
        self.content = u'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')

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.service.comment_check.side_effect({'side_effect': ''})
        self.akismet.check(self.content)
        self.akismet.service.comment_check.assert_called_once_with(
            self.content,
            data=self.expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_explicit_content_type(self, request, c):
        request.headers = self.fake_headers
        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.akismet.service.comment_check.assert_called_once_with(
            self.content,
            data=self.expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_artifact(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.check(self.content, artifact=self.fake_artifact)
        expected_data = self.expected_data
        expected_data['permalink'] = 'artifact url'
        self.akismet.service.comment_check.assert_called_once_with(
            self.content,
            data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.check(self.content, user=self.fake_user)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(
            self.content,
            data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_implicit_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = self.fake_user
        self.akismet.check(self.content)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(
            self.content,
            data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_spam(self, c):
        c.user = None

        self.akismet.submit_spam(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(comment_content=u'spåm text'.encode('utf8'),
                             comment_type='comment',
                             )
        self.akismet.service.submit_spam.assert_called_once_with(
            self.content, data=expected_data, build_data=False)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham(self, c):
        c.user = None

        self.akismet.submit_ham(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(comment_content=u'spåm text'.encode('utf8'),
                             comment_type='comment',
                             )
        self.akismet.service.submit_ham.assert_called_once_with(
            self.content, data=expected_data, build_data=False)
示例#7
0
class TestAkismet(unittest.TestCase):

    @mock.patch('allura.lib.spam.akismetfilter.akismet')
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({'spam.key': 'example', 'base_url': 'http://localhost/'})

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            urllib.urlencode(kw.get('data', {}))
        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_spam = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_ham = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(**{
            'main_url.return_value': '/artifact-url',
            'project_id': ObjectId(),
            'ref': None,
            'timestamp': datetime(2019, 5, 17),
            'primary.return_value': mock.Mock(
                mod_date=datetime(2019, 5, 17, 0, 5, 1)
            ),
            'get_version.return_value': mock.Mock(
                author=mock.Mock(
                    logged_ip='33.4.5.66',
                )
            ),
        })
        self.fake_user = mock.Mock(display_name=u'Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(
            USER_AGENT='some browser',
            REFERER='some url')
        self.content = u'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')

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.service.comment_check.side_effect({'side_effect': ''})
        self.akismet.check(self.content)
        self.akismet.service.comment_check.assert_called_once_with(**self.expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_explicit_content_type(self, request, c):
        request.headers = self.fake_headers
        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.akismet.service.comment_check.assert_called_once_with(**self.expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_artifact(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        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'
        self.akismet.service.comment_check.assert_called_once_with(**expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.check(self.content, user=self.fake_user)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(**expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_implicit_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = self.fake_user
        self.akismet.check(self.content)
        expected_data = self.expected_data
        expected_data.update(comment_author=u'Søme User'.encode('utf8'),
                             comment_author_email='user@domain')
        self.akismet.service.comment_check.assert_called_once_with(**expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_spam(self, c):
        c.user = None

        self.akismet.submit_spam(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(comment_content=u'spåm text'.encode('utf8'),
                             comment_type='comment',
                             user_ip='',
                             user_agent='',
                             )
        self.akismet.service.submit_spam.assert_called_once_with(**expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham(self, c):
        c.user = None

        self.akismet.submit_ham(self.content)

        # no IP addr, UA, etc, since this isn't the original request
        expected_data = dict(comment_content=u'spåm text'.encode('utf8'),
                             comment_type='comment',
                             user_ip='',
                             user_agent='',
                             )
        self.akismet.service.submit_ham.assert_called_once_with(**expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham_with_artifact(self, c):
        c.user = None

        self.akismet.submit_ham(self.content, artifact=self.fake_artifact)

        expected_data = dict(comment_content=u'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',
                             )
        self.akismet.service.submit_ham.assert_called_once_with(**expected_data)
示例#8
0
class TestAkismet(unittest.TestCase):
    @mock.patch('allura.lib.spam.akismetfilter.akismet')
    def setUp(self, akismet_lib):
        self.akismet = AkismetSpamFilter({
            'spam.key': 'example',
            'base_url': 'http://localhost/'
        })

        def side_effect(*args, **kw):
            # side effect to test that data being sent to
            # akismet can be successfully urlencoded
            six.moves.urllib.parse.urlencode(kw.get('data', {}))

        self.akismet.service.comment_check = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_spam = mock.Mock(side_effect=side_effect)
        self.akismet.service.submit_ham = mock.Mock(side_effect=side_effect)
        self.fake_artifact = mock.Mock(
            **{
                'main_url.return_value':
                '/artifact-url',
                'project_id':
                ObjectId(),
                'ref':
                None,
                'timestamp':
                datetime(2019, 5, 17),
                'primary.return_value':
                mock.Mock(mod_date=datetime(2019, 5, 17, 0, 5, 1)),
                'get_version.return_value':
                mock.Mock(author=mock.Mock(logged_ip='33.4.5.66', )),
            })
        self.fake_user = mock.Mock(display_name='Søme User',
                                   email_addresses=['user@domain'],
                                   _id=ObjectId())
        self.fake_headers = dict(USER_AGENT='some browser', REFERER='some url')
        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')

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        self.akismet.service.comment_check.side_effect({'side_effect': ''})
        self.akismet.check(self.content)
        self.akismet.service.comment_check.assert_called_once_with(
            **self.expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_explicit_content_type(self, request, c):
        request.headers = self.fake_headers
        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.akismet.service.comment_check.assert_called_once_with(
            **self.expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_artifact(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        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'
        self.akismet.service.comment_check.assert_called_once_with(
            **expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = None
        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')
        self.akismet.service.comment_check.assert_called_once_with(
            **expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    @mock.patch('allura.lib.spam.akismetfilter.request')
    def test_check_with_implicit_user(self, request, c):
        request.headers = self.fake_headers
        request.remote_addr = 'some ip'
        c.user = self.fake_user
        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')
        self.akismet.service.comment_check.assert_called_once_with(
            **expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_spam(self, c):
        c.user = None

        self.akismet.submit_spam(self.content)

        # 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='',
        )
        self.akismet.service.submit_spam.assert_called_once_with(
            **expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham(self, c):
        c.user = None

        self.akismet.submit_ham(self.content)

        # 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='',
        )
        self.akismet.service.submit_ham.assert_called_once_with(
            **expected_data)

    @mock.patch('allura.lib.spam.akismetfilter.c')
    def test_submit_ham_with_artifact(self, c):
        c.user = None

        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',
        )
        self.akismet.service.submit_ham.assert_called_once_with(
            **expected_data)