From d0fca5754590a0322b27152269a1f9bc71690bf7 Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Sun, 30 Dec 2012 13:31:08 +0800 Subject: [PATCH] tests/bundle: Check for form errors during bundle updates Add a check for patchform errors during bundle update operations, both when logged in as a maintainer and a regular user. This exposes a problem with the maintainer patchform: we see an unexpected form error with the state input. Signed-off-by: Jeremy Kerr --- apps/patchwork/tests/bundles.py | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/apps/patchwork/tests/bundles.py b/apps/patchwork/tests/bundles.py index 0404576..00a2323 100644 --- a/apps/patchwork/tests/bundles.py +++ b/apps/patchwork/tests/bundles.py @@ -127,6 +127,15 @@ class BundleUpdateTest(BundleTestBase): super(BundleUpdateTest, self).setUp() self.newname = 'newbundlename' + def checkPatchformErrors(self, response): + formname = 'patchform' + if not formname in response.context: + return + form = response.context[formname] + if not form: + return + self.assertEquals(form.errors, {}) + def publicString(self, public): if public: return 'on' @@ -159,6 +168,9 @@ class BundleUpdateTest(BundleTestBase): self.assertEqual(bundle.name, newname) self.assertEqual(bundle.public, self.bundle.public) + # check other forms for errors + self.checkPatchformErrors(response) + def testUpdatePublic(self): newname = 'newbundlename' data = { @@ -173,6 +185,17 @@ class BundleUpdateTest(BundleTestBase): self.assertEqual(bundle.name, self.bundle.name) self.assertEqual(bundle.public, not self.bundle.public) + # check other forms for errors + self.checkPatchformErrors(response) + +class BundleMaintainerUpdateTest(BundleUpdateTest): + + def setUp(self): + super(BundleMaintainerUpdateTest, self).setUp() + profile = self.user.get_profile() + profile.maintainer_projects.add(defaults.project) + profile.save() + class BundlePublicViewTest(BundleTestBase): def setUp(self): -- 2.39.2