@mock.patch.object(system_users, 'NARRATOR_USER', None)
  def testWelcomeUsers(self):
    """Test that users that are part of the "Welcome to Viewfinder" conversation are created."""
    def _TestUser(email):
      identity = self._RunAsync(Identity.Query, self._client, email % 'Email:%s', None)
      self.assertEqual(identity.authority, 'Viewfinder')

      user = self._RunAsync(User.Query, self._client, identity.user_id, None)
      self.assertTrue(user.IsRegistered())
      self.assertTrue(user.IsSystem())
      self.assertEqual(user.email, email)

      settings = self._RunAsync(AccountSettings.QueryByUser, self._client, identity.user_id, None)
      self.assertEqual(settings.email_alerts, AccountSettings.EMAIL_NONE)

      return user.name, user.given_name, user.family_name

    def _TestUpload(user, upload_request):
      # Get episode that should have been uploaded.
      cookie = self._GetSecureUserCookie(user, user.webapp_dev_id)
      ep_select = self._tester.CreateEpisodeSelection(upload_request['episode']['episode_id'],
                                                      get_attributes=True,
                                                      get_photos=True)
      response_dict = self._tester.SendRequest('query_episodes', cookie, {'episodes': [ep_select]})
      ep_dict = response_dict['episodes'][0]
      self.assertEqual(len(upload_request['photos']), len(ep_dict['photos']))

      # Validate that each photo was uploaded.
      for ph_dict in response_dict['episodes'][0]['photos']:
        for suffix, size_attr in (('.f', 'full_size'), ('.m', 'med_size'), ('.t', 'tn_size')):
          response = self._tester.GetPhotoImage(cookie, ep_dict['episode_id'], ph_dict['photo_id'], suffix)
          self.assertEqual(len(response.body), ph_dict[size_attr])

    # Ensure that system users are created.
    self._RunAsync(CreateSystemUsers, self._client)

    # Verify users.
    self.assertEqual(_TestUser('narrator@emailscrubbed.com'), ('Viewfinder', 'Viewfinder', None))

    # Verify photo uploads.
    _TestUpload(system_users.NARRATOR_USER, system_users.NARRATOR_UPLOAD_PHOTOS)
dataset/ETHPy150Open viewfinderco/viewfinder/backend/www/test/create_prospective_test.py/CreateProspectiveTestCase.testWelcomeUsers/swapped operands of `%`