From 1c2eade58c91de449b95435f39730aa1de321353 Mon Sep 17 00:00:00 2001 From: Adam Williamson Date: May 15 2020 18:17:35 +0000 Subject: Fix and test seedtext for ValidationPages I broke this in the f-string conversion, and it turns out there were no tests so I didn't catch it till I happened to notice it in a manual check. So let's fix it and add tests! We also correct the test for the GA milestone: we were using "Final" as the milestone name in the test, but that's not how it works in reality, the GA milestone is called "RC" now and has been ever since Pungi 4 arrived. Tweaking the test revealed some interesting behaviours in the sort helpers that I hadn't noticed before, so we also add an "RC" entry to the milestone pairs for the sort substitutions... Signed-off-by: Adam Williamson --- diff --git a/src/wikitcms/helpers.py b/src/wikitcms/helpers.py index e42bdcd..f6c4c6a 100644 --- a/src/wikitcms/helpers.py +++ b/src/wikitcms/helpers.py @@ -38,6 +38,7 @@ MILESTONE_PAIRS = ( ("Preview", "600"), ("Pre-Final", "775"), ("Final", "800"), + ("RC", "800"), ("Postrelease", "900"), ) diff --git a/src/wikitcms/page.py b/src/wikitcms/page.py index 22b03b4..067c8b3 100644 --- a/src/wikitcms/page.py +++ b/src/wikitcms/page.py @@ -437,7 +437,7 @@ class ComposePage(ValidationPage): tmpl = "Validation results" self.seedtext = ( f"{{{{subst:{tmpl}|testtype={testtype}|release={self.release}|" - f"milestone={self.milestone}|compose={self.compose}" + f"milestone={self.milestone}|compose={self.compose}}}}}" ) @@ -473,7 +473,7 @@ class NightlyPage(ValidationPage): tmpl = "Validation results" self.seedtext = ( f"{{{{subst:{tmpl}|testtype={testtype}|release={self.release}|" - f"milestone={self.milestone}|date={self.compose}" + f"milestone={self.milestone}|date={self.compose}}}}}" ) diff --git a/tests/test_page.py b/tests/test_page.py index 560bc9a..2eaa062 100644 --- a/tests/test_page.py +++ b/tests/test_page.py @@ -176,7 +176,7 @@ class TestValidationPages: self.site, "27", "Base", "Branched", "20171123.n.1", modular=True ) # typical candidate page (should *not* be modular) - candidate = wikitcms.page.ComposePage(self.site, "32", "Desktop", "Final", "1.2") + candidate = wikitcms.page.ComposePage(self.site, "32", "Desktop", "RC", "1.2") # modular candidate page (based on the only modular compose we # ever did...) modcandidate = wikitcms.page.ComposePage( @@ -200,6 +200,10 @@ class TestValidationPages: ) assert nightly.sortname == "32 100 20200122.n.0 Installation" assert nightly.sorttuple == (32, 100, Decimal("20200122.0"), "Installation") + assert nightly.seedtext == ( + "{{subst:Validation results|testtype=Installation|release=32|milestone=Rawhide" + "|date=20200122.n.0}}" + ) assert modnightly.release == "27" assert modnightly.milestone == "Branched" @@ -219,24 +223,35 @@ class TestValidationPages: ) assert modnightly.sortname == "27 150 20171123.n.1 Base" assert modnightly.sorttuple == (27, 150, Decimal("20171123.1"), "Base") + assert modnightly.seedtext == ( + "{{subst:Modular validation results|testtype=Base|release=27|milestone=Branched" + "|date=20171123.n.1}}" + ) assert candidate.release == "32" - assert candidate.milestone == "Final" + assert candidate.milestone == "RC" assert candidate.compose == "1.2" - assert candidate.version == "32 Final 1.2" + assert candidate.version == "32 RC 1.2" assert candidate.testtype == "Desktop" assert candidate.modular is False - assert candidate.checkname == "Test Results:Fedora 32 Final 1.2 Desktop" + assert candidate.checkname == "Test Results:Fedora 32 RC 1.2 Desktop" assert candidate.summary == ( - "Relval bot-created Desktop validation results page for " "Fedora 32 Final 1.2" + "Relval bot-created Desktop validation results page for " "Fedora 32 RC 1.2" ) assert candidate.results_separators == ( "Test Matri", "Test Areas", "An unsupported test or configuration. No testing is required.", ) - assert candidate.sortname == "32 800 1.2 Desktop" + # 6000 here is actually the value intended for "RC" as part of + # a *compose* value, not "RC" as a *milestone* (with Pungi 4, + # the GA milestone name changed from "Final" to "RC"). But it + # doesn't seem to break anything, so I'm leaving it alone + assert candidate.sortname == "32 6000 1.2 Desktop" assert candidate.sorttuple == (32, 800, Decimal("1.2"), "Desktop") + assert candidate.seedtext == ( + "{{subst:Validation results|testtype=Desktop|release=32|milestone=RC|compose=1.2}}" + ) assert modcandidate.release == "27" assert modcandidate.milestone == "Beta" @@ -255,6 +270,10 @@ class TestValidationPages: ) assert modcandidate.sortname == "27 400 1.5 Server" assert modcandidate.sorttuple == (27, 400, Decimal("1.5"), "Server") + assert modcandidate.seedtext == ( + "{{subst:Modular validation results|testtype=Server|release=27|milestone=Beta" + "|compose=1.5}}" + ) def test_results_sections(self, fakeapisections): """Test the results_sections property."""