def test_guess_builder_from_path_not_found(self): bs = ['build1', 'build2'] pr = 'testprj' path = '/testprj/docs/build__NOTFOUND/doc1' builder, found = guess_builder_from_path(bs, pr, path) assert builder == 'build1' assert found is False
def test_guess_builder_from_path_found_second_one(self): bs = ['build1', 'build2'] pr = 'testprj' path = '/testprj/docs/build2/doc1' builder, found = guess_builder_from_path(bs, pr, path) assert builder == 'build2' assert found is True
def _q_access(self, request): self.docs = SphinxDocs(self.proj) if not self.docs.enabled: raise TraversalError( "docs not enabled: %s" % self.docs.disabled_reason) self.builder_name, self.explicit_builder = guess_builder_from_path( self.docs.builders, self.proj, request.get_path()) if self.explicit_builder: self.base_path = "/%s/docs/%s/" % (self.proj, self.builder_name) else: self.base_path = "/%s/docs/" % (self.proj) self.builder = self.docs.get_builder(self.builder_name) if not self.builder: raise TraversalError("Unknown builder")