def testFilterWithTwoEntriesOnlyOneValid(self): xml = ElementTree() xml.parse(os.path.dirname(__file__) + "/valid-multiple-entries.xml") manifests = ManifestDownloader()._extractManifestInfos(xml) Policy.POLICY_CFG = os.path.dirname(__file__) + "/policy.cfg" policy = Policy() policy._downloadManifests = Mock(return_value=manifests) filteredManifestList = policy.check(manifests[0].identifier) self.assertEqual(1, len(filteredManifestList))
def _validateMarketplaceImagePolicy(self): try: policy = Policy(self.configHolder) policy.check(self.marketplaceImageId) except: raise Exception('Policy validation failed')