def traverse(self, segments):
     stack = list(reversed(['+branch'] + segments))
     name = stack.pop()
     request = FakeLaunchpadRequest([], stack)
     traverser = specification.SpecificationNavigation(
         self.specification, request)
     return traverser.publishTraverse(request, name)
Ejemplo n.º 2
0
 def test_missing_person_structural_subscription_traversal(self):
     # Verify that a NotFound is raised when attempting to reach
     # a structural subscription for a person that does not exist.
     request = FakeLaunchpadRequest([], ['doesnotexist'])
     self.assertRaises(
         NotFound,
         self.navigation(self.target, request).publishTraverse, request,
         '+subscription')
Ejemplo n.º 3
0
 def test_structural_subscription_traversal(self):
     # Verify that an existing structural subscription can be
     # reached from the target.
     request = FakeLaunchpadRequest([], ['eric'])
     self.assertEqual(
         self.target.getSubscription(self.eric),
         self.navigation(self.target,
                         request).publishTraverse(request, '+subscription'))
    def traverse(self, segments):
        """Traverse to 'segments' using a 'PersonNavigation' object.

        Using the Zope traversal machinery, traverse to the path given by
        'segments', starting at a `PersonNavigation` object wrapped around the
        'person' attribute.

        :param segments: A list of path segments.
        :return: The object found.
        """
        stack = list(reversed(segments))
        name = stack.pop()
        request = FakeLaunchpadRequest(['~' + self.person.name], stack)
        traverser = PersonNavigation(self.person, request)
        return traverser.publishTraverse(request, name)
Ejemplo n.º 5
0
 def traverse(self, spph, segments):
     req = FakeLaunchpadRequest([], segments[1:])
     nav = SourcePackagePublishingHistoryNavigation(spph, req)
     return nav.publishTraverse(req, segments[0])
Ejemplo n.º 6
0
 def test_ignored_stepthrough(self):
     # The stepthrough is ignored since the next path item is a zope
     # namespace.
     request = FakeLaunchpadRequest(['~dummy'], ['++model++'])
     self.assertEqual('+step', self.traverse(request, '+step'))
     self.assertEqual('++model++', request.stepstogo.peek())
Ejemplo n.º 7
0
 def test_normal_stepthrough(self):
     # The stepthrough is processed normally.
     request = FakeLaunchpadRequest(['~dummy'], ['fred'])
     self.assertEqual('stepthrough-fred', self.traverse(request, '+step'))