def testGet(self):
    """Test get()."""
    self.mox.StubOutWithMock(maint.models, 'PackageInfo')
    self.mox.StubOutWithMock(maint.blobstore, 'BlobInfo')
    self.mox.StubOutWithMock(maint.time, 'sleep')
    self.mox.StubOutWithMock(maint.mail, 'SendMail')
    blobstore_key_good = 'goodkey'
    blobstore_key_bad = 'badkey'
    filename_bad = 'badfilename'

    # verify PackageInfo entities have Blobstore blobs.
    mock_pkginfo_good = self.mox.CreateMockAnything()
    mock_pkginfo_bad = self.mox.CreateMockAnything()
    mock_pkginfo_good.blobstore_key = blobstore_key_good
    mock_pkginfo_bad.blobstore_key = blobstore_key_bad
    mock_pkginfo_bad.filename = filename_bad
    mock_pkginfo_bad.mtime = maint.datetime.datetime(1970, 1, 1)
    pkginfos = [mock_pkginfo_good, mock_pkginfo_bad]
    maint.models.PackageInfo.all().AndReturn(pkginfos)
    maint.blobstore.BlobInfo.get(
        mock_pkginfo_good.blobstore_key).AndReturn(True)
    maint.blobstore.BlobInfo.get(
        mock_pkginfo_bad.blobstore_key).AndReturn(None)

    maint.mail.SendMail(
        mox.IgnoreArg(), 'Package is lacking a file: %s' % filename_bad,
        mox.IgnoreArg()).AndReturn(None)

    # verify Blobstore blobs are not orphaned.
    blob_good = self.mox.CreateMockAnything()
    blob_bad = self.mox.CreateMockAnything()
    blob_bad.filename = filename_bad
    blobs = [blob_good, blob_bad]
    maint.blobstore.BlobInfo.all().AndReturn(blobs)
    # good blob
    blob_good.key().AndReturn(blobstore_key_good)
    self.MockPackageInfoQuery(blobstore_key_good, return_value='non None')
    # bad blob
    blob_bad.key().AndReturn(blobstore_key_bad)
    self.MockPackageInfoQuery(blobstore_key_bad, sleep=1)  # attempt 1
    self.MockPackageInfoQuery(blobstore_key_bad, sleep=1)  # attempt 2
    self.MockPackageInfoQuery(blobstore_key_bad, sleep=1)  # attempt 3
    self.MockPackageInfoQuery(blobstore_key_bad, sleep=1)  # attempt 4
    self.MockPackageInfoQuery(blobstore_key_bad)  # attempt 5

    maint.mail.SendMail(
        mox.IgnoreArg(), filename_bad % 'Orphaned Blob in Blobstore: %s',
        mox.IgnoreArg()).AndReturn(None)

    self.mox.ReplayAll()
    self.c.get()
    self.mox.VerifyAll()
dataset/ETHPy150Open google/simian/src/tests/simian/mac/cron/maintenance_test.py/VerifyPackagesCleanupTest.testGet/swapped operands of `%`