def test_searchForTerms_commercial_admin(self): # Users with launchpad.Commercial can search for any active project. expert = login_celebrity('commercial_admin') self.vocab = CommercialProjectsVocabulary(context=expert) self.assertEqual(1, len(self.vocab.searchForTerms(u'open-widget'))) self.assertEqual( 0, len(self.vocab.searchForTerms(u'norwegian-blue-widget')))
def test_contains_commercial_admin(self): # The vocabulary contains all active projects for commercial. other_project = self.factory.makeProduct() expert = login_celebrity('commercial_admin') self.vocab = CommercialProjectsVocabulary(context=expert) self.assertIs(True, other_project in self.vocab) self.assertIs(False, self.deactivated_project in self.vocab) self.assertIs(True, self.maintained_project in self.vocab)
def setUp(self): super(TestCommProjVocabulary, self).setUp() self.owner = self.factory.makePerson( email_address_status=EmailAddressStatus.VALIDATED) self._createProjects() self.vocab = CommercialProjectsVocabulary(context=self.owner)