示例#1
0
    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()
示例#2
0
 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'])