Merge branch 'main' into avm99963-monorail

Merged commit 3779da353b36d43cf778e7d4f468097714dd4540

GitOrigin-RevId: 6451a5c6b75afb0fd1f37b3f14521148d0722ea8
diff --git a/features/test/inboundemail_test.py b/features/test/inboundemail_test.py
index 0eaa281..de05749 100644
--- a/features/test/inboundemail_test.py
+++ b/features/test/inboundemail_test.py
@@ -9,14 +9,14 @@
 from __future__ import absolute_import
 
 import unittest
-import webapp2
-from mock import patch
 
-import mox
+try:
+  from mox3 import mox
+except ImportError:
+  import mox
 import time
 
 from google.appengine.api import mail
-from google.appengine.ext.webapp.mail_handlers import BounceNotificationHandler
 
 import settings
 from businesslogic import work_env
@@ -58,8 +58,7 @@
     self.msg = testing_helpers.MakeMessage(
         testing_helpers.HEADER_LINES, 'awesome!')
 
-    request, _ = testing_helpers.GetRequestObjects()
-    self.inbound = inboundemail.InboundEmail(request, None, self.services)
+    self.inbound = inboundemail.InboundEmail(self.services)
     self.mox = mox.Mox()
 
   def tearDown(self):
@@ -348,10 +347,7 @@
         user=fake.UserService())
     self.user = self.services.user.TestAddUser('user@example.com', 111)
 
-    app = webapp2.WSGIApplication(config={'services': self.services})
-    app.set_globals(app=app)
-
-    self.servlet = inboundemail.BouncedEmail()
+    self.servlet = inboundemail.BouncedEmail(self.services)
     self.mox = mox.Mox()
 
   def tearDown(self):
@@ -369,8 +365,6 @@
 
   def testReceive_NoSuchUser(self):
     """When not found, log it and ignore without creating a user record."""
-    self.servlet.request = webapp2.Request.blank(
-        '/', POST={'raw-message': 'this is an email message'})
     bounce_message = testing_helpers.Blank(
         original={'to': 'nope@example.com'},
         notification='notification')