Merge ~adam-collard/maas:docs-index-to-index into maas:master

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: d75e205b35abac9296d363b1e140c417f5901645
Merge reported by: MAAS Lander
Merged at revision: not available
Proposed branch: ~adam-collard/maas:docs-index-to-index
Merge into: maas:master
Diff against target: 61 lines (+15/-5)
2 files modified
src/maasserver/tests/test_webapp.py (+13/-5)
src/maasserver/webapp.py (+2/-0)
Reviewer Review Type Date Requested Status
MAAS Lander Approve
Björn Tillenius Approve
Review via email: mp+398552@code.launchpad.net

Commit message

LP: #1913323 - Redirect docs/ to index

To post a comment you must log in.
Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b docs-index-to-index lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/9285/console
COMMIT: d75e205b35abac9296d363b1e140c417f5901645

review: Needs Fixing
Revision history for this message
Adam Collard (adam-collard) wrote :

jenkins: !test

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b docs-index-to-index lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: FAILED
LOG: http://maas-ci.internal:8080/job/maas/job/branch-tester/9289/console
COMMIT: d75e205b35abac9296d363b1e140c417f5901645

review: Needs Fixing
Revision history for this message
Björn Tillenius (bjornt) wrote :

+1

review: Approve
Revision history for this message
Adam Collard (adam-collard) wrote :

jenkins: !test

Revision history for this message
MAAS Lander (maas-lander) wrote :

UNIT TESTS
-b docs-index-to-index lp:~adam-collard/maas/+git/maas into -b master lp:~maas-committers/maas

STATUS: SUCCESS
COMMIT: d75e205b35abac9296d363b1e140c417f5901645

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/src/maasserver/tests/test_webapp.py b/src/maasserver/tests/test_webapp.py
2index 3edc12a..8e502b4 100644
3--- a/src/maasserver/tests/test_webapp.py
4+++ b/src/maasserver/tests/test_webapp.py
5@@ -38,30 +38,38 @@ class TestDocsFallbackFile(MAASTestCase):
6 def test_html_404(self):
7 request = DummyRequest([b"foo.html"])
8 resource = self.docs.getChild(b"foo.html", request)
9- self.assertTrue(resource.path.endswith("404.html"))
10+ self.assertTrue(resource.path.endswith("404.html"), resource.path)
11
12 def test_other_404(self):
13 request = DummyRequest([b"foo.jpg"])
14 resource = self.docs.getChild(b"foo.jpg", request)
15- self.assertTrue(resource.path.endswith("404.html"))
16+ self.assertTrue(resource.path.endswith("404.html"), resource.path)
17
18 def test_html_resource(self):
19 self.touch_file("foo.html")
20 request = DummyRequest([b"foo.html"])
21 resource = self.docs.getChild(b"foo.html", request)
22- self.assertTrue(resource.path.endswith("foo.html"))
23+ self.assertTrue(resource.path.endswith("foo.html"), resource.path)
24
25 def test_other_resource(self):
26 self.touch_file("foo.jpg")
27 request = DummyRequest([b"foo.jpg"])
28 resource = self.docs.getChild(b"foo.jpg", request)
29- self.assertTrue(resource.path.endswith("foo.jpg"))
30+ self.assertTrue(resource.path.endswith("foo.jpg"), resource.path)
31
32 def test_append_html(self):
33 self.touch_file("foo.html")
34 request = DummyRequest([b"foo"])
35 resource = self.docs.getChild(b"foo", request)
36- self.assertTrue(resource.path.endswith("foo.html"))
37+ self.assertTrue(resource.path.endswith("foo.html"), resource.path)
38+
39+ def test_index(self):
40+ self.touch_file("maas-documentation-25.html")
41+ request = DummyRequest([b""])
42+ resource = self.docs.getChild(b"", request)
43+ self.assertTrue(
44+ resource.path.endswith("maas-documentation-25.html"), resource.path
45+ )
46
47
48 class TestCleanPathRequest(MAASTestCase):
49diff --git a/src/maasserver/webapp.py b/src/maasserver/webapp.py
50index b325bfb..c3ab7b9 100644
51--- a/src/maasserver/webapp.py
52+++ b/src/maasserver/webapp.py
53@@ -181,6 +181,8 @@ class DocsFallbackFile(NoListingFile):
54 self.childNotFound = DefaultFile(self.child(fallback).path)
55
56 def getChild(self, path, request):
57+ if path == b"":
58+ return self.getChild("maas-documentation-25.html", request)
59 child = super().getChild(path, request)
60 if child is self.childNotFound and not path.endswith(b".html"):
61 child = super().getChild(path + b".html", request)

Subscribers

People subscribed via source and target branches