예제 #1
0
 def test_navigation_tree_has_tutorials(self):
     subscribe(db=self.session, user=self.user, tutorial=self.tutorial)
     self.tutorial.lecture.term = muesli.utils.getSemesterLimit()
     request = DummyRequest()
     request.user = self.user
     tree = create_navigation_tree(request)
     self.assertEqual(len(tree.children), 1)
     self.assertEqual(len(tree.children[0].children), 1)
     self.assertIn(self.tutorial.lecture.name,
                   tree.children[0].children[0].label)
예제 #2
0
 def test_navigation_tree_tutor(self):
     self.tutorial.lecture.term = muesli.utils.getSemesterLimit()
     request = DummyRequest()
     request.user = self.tutor
     tree = create_navigation_tree(request)
     self.assertEqual(len(tree.children), 1)
     self.assertIn("Vorlesungsorganisation", tree.children[0].label)
     self.assertEqual(len(tree.children[0].children), 1)
     self.assertIn(self.tutorial.lecture.name,
                   tree.children[0].children[0].label)
     self.assertEqual(len(tree.children[0].children[0].children), 3)
     self.assertIn("Übungsgruppen",
                   tree.children[0].children[0].children[0].label)
예제 #3
0
def add_navigationTree_to_request(event):
    event.request.navigationTree = create_navigation_tree(
        event.request, event.request.user)
예제 #4
0
 def test_navigation_tree_no_tutorials(self):
     request = DummyRequest()
     request.user = self.user_without_lecture
     tree = create_navigation_tree(request)
     self.assertFalse(tree.children)
예제 #5
0
 def test_navigation_tree_empty_login(self):
     request = DummyRequest()
     request.user = None
     tree = create_navigation_tree(request)
     self.assertFalse(tree.children)
예제 #6
0
def add_navigation_tree_to_request(event):
    # Add navigation tree
    if event['request']:
        event['navigation_tree'] = create_navigation_tree(event['request'])