def testPackageExistsFalse(self): """Tests the success path for PackageExists().""" filename = 'badname' self.mox.StubOutWithMock(pkgs.models.PackageInfo, 'get_by_key_name') pkgs.models.PackageInfo.get_by_key_name(filename).AndReturn(None) self.mox.ReplayAll() self.assertFalse(pkgs.PackageExists(filename)) self.mox.VerifyAll()
def ValidatePackageExists(self): """Verifies if a particular package exists or not.""" if not pkgs.PackageExists(self._plist['installer_item_location']): raise PackageDoesNotExistError( 'Package %s does not exist' % self._plist['installer_item_location'])