class TestBugInformationTypePortletView(TestCaseWithFactory): layer = DatabaseFunctionalLayer def setUp(self): super(TestBugInformationTypePortletView, self).setUp() login('*****@*****.**') self.bug = self.factory.makeBug() self.view = BugInformationTypePortletView( self.bug, LaunchpadTestRequest()) def test_information_type(self): self.bug.transitionToInformationType( InformationType.USERDATA, self.bug.owner) self.assertEqual( self.bug.information_type.title, self.view.information_type) self.assertEqual( self.bug.information_type.description, self.view.information_type_description) def test_information_type_css_class(self): self.bug.transitionToInformationType( InformationType.USERDATA, self.bug.owner) self.assertEqual('sprite private', self.view.information_type_css) self.bug.transitionToInformationType( InformationType.PUBLICSECURITY, self.bug.owner) self.assertEqual('sprite public', self.view.information_type_css) def test_proprietary_excluded_for_normal_projects(self): # The Proprietary information type isn't in the JSON request cache for # normal projects without proprietary bugs configured. self.view.initialize() cache = IJSONRequestCache(self.view.request) expected = [ InformationType.PUBLIC.name, InformationType.PUBLICSECURITY.name, InformationType.PRIVATESECURITY.name, InformationType.USERDATA.name] self.assertContentEqual(expected, [ type['value'] for type in cache.objects['information_type_data'].values()])
def setUp(self): super(TestBugInformationTypePortletView, self).setUp() login('*****@*****.**') self.bug = self.factory.makeBug() self.view = BugInformationTypePortletView( self.bug, LaunchpadTestRequest())