예제 #1
0
 def test_add_subject_breadcrumb_item_label(self):
     testsubject = mommy.make('core.Subject', short_name='testsubject')
     mock_cradmin_instance = mock.MagicMock()
     mock_cradmin_instance.get_devilryrole_for_requestuser.return_value = 'departmentadmin'
     menu = devilry_crmenu_admin.Menu(
         cradmin_instance=mock_cradmin_instance)
     menuitem = menu.add_subject_breadcrumb_item(subject=testsubject)
     self.assertEqual('testsubject', menuitem.label)
예제 #2
0
 def test_add_subject_breadcrumb_item_exclude_devilryrole_periodadmin(self):
     testsubject = mommy.make('core.Subject')
     mock_cradmin_instance = mock.MagicMock()
     mock_cradmin_instance.get_devilryrole_for_requestuser.return_value = 'periodadmin'
     menu = devilry_crmenu_admin.Menu(
         cradmin_instance=mock_cradmin_instance)
     menuitem = menu.add_subject_breadcrumb_item(subject=testsubject)
     self.assertIsNone(menuitem)
예제 #3
0
 def test_add_period_breadcrumb_item_label_devilryrole_periodadmin(self):
     testperiod = mommy.make('core.Period',
                             parentnode__short_name='testsubject',
                             short_name='testperiod')
     mock_cradmin_instance = mock.MagicMock()
     mock_cradmin_instance.get_devilryrole_for_requestuser.return_value = 'periodadmin'
     menu = devilry_crmenu_admin.Menu(
         cradmin_instance=mock_cradmin_instance)
     menuitem = menu.add_period_breadcrumb_item(period=testperiod)
     self.assertEqual('testsubject.testperiod', menuitem.label)