launchpad-reviewers team mailing list archive
-
launchpad-reviewers team
-
Mailing list archive
-
Message #25708
[Merge] ~twom/launchpad:git-branch-picker-fix-tests into launchpad:master
Tom Wardill has proposed merging ~twom/launchpad:git-branch-picker-fix-tests into launchpad:master.
Commit message:
Fix missing path tests in git ref widget
Requested reviews:
Launchpad code reviewers (launchpad-reviewers)
For more details, see:
https://code.launchpad.net/~twom/launchpad/+git/launchpad/+merge/394239
--
Your team Launchpad code reviewers is requested to review the proposed merge of ~twom/launchpad:git-branch-picker-fix-tests into launchpad:master.
diff --git a/lib/lp/code/browser/widgets/tests/test_gitrefwidget.py b/lib/lp/code/browser/widgets/tests/test_gitrefwidget.py
index 2e2526c..92c0569 100644
--- a/lib/lp/code/browser/widgets/tests/test_gitrefwidget.py
+++ b/lib/lp/code/browser/widgets/tests/test_gitrefwidget.py
@@ -17,6 +17,7 @@ from zope.interface import (
implementer,
Interface,
)
+from zope.schema import ValidationError
from lp.app.validators import LaunchpadValidationError
from lp.code.browser.widgets.gitref import GitRefWidget
@@ -149,6 +150,12 @@ class TestGitRefWidget(WithScenarios, TestCaseWithFactory):
self.assertEqual(LaunchpadValidationError(message), e.errors)
self.assertEqual(html_escape(message), self.widget.error())
+ def assertValidationError(self, form, message):
+ self.widget.request = LaunchpadTestRequest(form=form)
+ e = self.assertRaises(WidgetInputError, self.widget.getInputValue)
+ self.assertIsInstance(e.errors, ValidationError)
+ self.assertEqual(html_escape(message), self.widget.error())
+
def test_getInputValue_repository_missing(self):
# An error is raised when the repository field is missing.
form = {
@@ -186,7 +193,7 @@ class TestGitRefWidget(WithScenarios, TestCaseWithFactory):
"field.git_ref.repository": repository.unique_name,
"field.git_ref.path": "",
}
- self.assertGetInputValueError(form, "Please enter a Git branch path.")
+ self.assertValidationError(form, "Required input is missing.")
def test_getInputValue_path_invalid(self):
# An error is raised when the branch path does not identify a