Merge branch 'main' into avm99963-monorail
Merged commit 34d8229ae2b51fb1a15bd208e6fe6185c94f6266
GitOrigin-RevId: 7ee0917f93a577e475f8e09526dd144d245593f4
diff --git a/features/test/banspammer_test.py b/features/test/banspammer_test.py
index e12c506..f96358a 100644
--- a/features/test/banspammer_test.py
+++ b/features/test/banspammer_test.py
@@ -1,7 +1,6 @@
-# Copyright 2016 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style
-# license that can be found in the LICENSE file or at
-# https://developers.google.com/open-source/licenses/bsd
+# Copyright 2016 The Chromium Authors
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
"""Tests for the ban spammer feature."""
from __future__ import print_function
@@ -10,6 +9,7 @@
import json
import mock
+import six
import unittest
from six.moves import urllib
@@ -18,7 +18,7 @@
from framework import framework_views
from framework import permissions
from framework import urls
-from proto import tracker_pb2
+from mrproto import tracker_pb2
from services import service_manager
from testing import fake
from testing import testing_helpers
@@ -72,7 +72,7 @@
'app_engine_http_request':
{
'relative_uri': urls.BAN_SPAMMER_TASK + '.do',
- 'body': urllib.parse.urlencode(params),
+ 'body': six.ensure_binary(urllib.parse.urlencode(params)),
'headers': {
'Content-type': 'application/x-www-form-urlencoded'
}
@@ -81,8 +81,8 @@
get_client_mock().queue_path.assert_called_with(
settings.app_id, settings.CLOUD_TASKS_REGION, 'default')
get_client_mock().create_task.assert_called_once()
- ((_parent, called_task), _kwargs) = get_client_mock().create_task.call_args
- self.assertEqual(called_task, task)
+ _, kwargs = get_client_mock().create_task.call_args
+ self.assertEqual(kwargs['task'], task)
class BanSpammerTaskTest(unittest.TestCase):
@@ -102,9 +102,12 @@
def testProcessFormData_okSomeIssues(self):
mr = testing_helpers.MakeMonorailRequest(
- path=urls.BAN_SPAMMER_TASK + '.do', method='POST',
- params={'spammer_id': 111, 'reporter_id': 222})
-
+ path=urls.BAN_SPAMMER_TASK + '.do',
+ method='POST',
+ params={
+ 'spammer_id': 111,
+ 'reporter_id': 222
+ })
for i in range(0, 10):
issue = fake.MakeTestIssue(
1, i, 'issue_summary', 'New', 111, project_name='project-name')