def testGet(self):
    """Test get()."""
    pkginfo1 = self.mox.CreateMockAnything()
    pkginfo1.name = 'name1'
    pkginfo1.filename = 'filename1'
    pkginfo1.plist = 'plist1'
    pkginfo1.version = '1.2.3'
    pkg1_munki_name = '%s-%s' % (pkginfo1.name, pkginfo1.version)
    pkginfo1.munki_name = pkg1_munki_name
    pkg1_lock = 'pkgsinfo_%s' % pkginfo1.filename
    mock_pl1 = self.mox.CreateMockAnything()
    pkginfo1.plist = mock_pl1

    pkginfos = [pkginfo1]

    install_counts = {
        pkg1_munki_name: {
            'install_count': 3,
            'applesus': True,
            'duration_count': 2,
            'duration_total_seconds': 50,
            'duration_seconds_avg': int(2/(50)),
         },
    }

    pkg1_avg_duration_text = maint.models.PackageInfo.AVG_DURATION_TEXT % (
        install_counts[pkg1_munki_name]['duration_count'],
        install_counts[pkg1_munki_name]['duration_seconds_avg'])
    pkg1_desc = 'This pkg is cool!'
    pkg1_desc_updated = '%s\n\n%s' % (pkg1_desc, pkg1_avg_duration_text)

    # Start with the description lacking avg duration text.
    pkginfo1.description = pkg1_desc

    self.mox.StubOutWithMock(maint.models.ReportsCache, 'GetInstallCounts')
    self.mox.StubOutWithMock(maint.models.PackageInfo, 'all')
    self.mox.StubOutWithMock(maint.gae_util, 'ObtainLock')
    self.mox.StubOutWithMock(maint.gae_util, 'ReleaseLock')
    self.mox.StubOutWithMock(maint.models.Catalog, 'all')
    self.mox.StubOutWithMock(maint.models.Catalog, 'Generate')

    maint.models.ReportsCache.GetInstallCounts().AndReturn(
        (install_counts, None))
    maint.models.PackageInfo.all().AndReturn(pkginfos)
    maint.gae_util.ObtainLock(pkg1_lock, timeout=5.0).AndReturn(True)
    mock_pl1.__getitem__('description').AndReturn(pkg1_desc)
    mock_pl1.__getitem__('description').AndReturn(pkg1_desc_updated)
    pkginfo1.put().AndReturn(None)
    maint.gae_util.ReleaseLock(pkg1_lock).AndReturn(None)

    delay = 0
    for track in maint.common.TRACKS:
      delay += 5
      maint.models.Catalog.Generate(track, delay=delay)

    self.mox.ReplayAll()
    self.c.get()
    self.assertEqual(pkginfo1.description, pkg1_desc_updated)
    self.mox.VerifyAll()
dataset/ETHPy150Open google/simian/src/tests/simian/mac/cron/maintenance_test.py/UpdateAverageInstallDurationsTest.testGet/swapped operands of `/`