def test_getTermByToken_token_with_cacheless_distribution(self): # The term is returned if it does not match an official DSP, # provided that the distribution has no cached package names. dsp = self.factory.makeDistributionSourcePackage( sourcepackagename='foo', with_db=False) vocabulary = DistributionSourcePackageVocabulary(dsp.distribution) term = vocabulary.getTermByToken(dsp.name) self.assertEqual(dsp, term.value)
def test_getTermByToken_token(self): # The term is returned if it matches an official DSP. spph = self.factory.makeSourcePackagePublishingHistory() dsp = spph.distroseries.distribution.getSourcePackage( spph.sourcepackagerelease.sourcepackagename) vocabulary = DistributionSourcePackageVocabulary(dsp.distribution) term = vocabulary.getTermByToken(dsp.name) self.assertEqual(dsp, term.value)