Merge lp://staging/~bryce/launchpad/bugtracker_component_test_refactor into lp://staging/launchpad

Proposed by Bryce Harrington
Status: Merged
Approved by: Robert Collins
Approved revision: no longer in the source branch.
Merged at revision: 13297
Proposed branch: lp://staging/~bryce/launchpad/bugtracker_component_test_refactor
Merge into: lp://staging/launchpad
Diff against target: 154 lines (+52/-52)
2 files modified
lib/lp/bugs/browser/tests/test_bugtracker_component.py (+49/-44)
lib/lp/bugs/doc/bugtracker.txt (+3/-8)
To merge this branch: bzr merge lp://staging/~bryce/launchpad/bugtracker_component_test_refactor
Reviewer Review Type Date Requested Status
Henning Eggers (community) Approve
Review via email: mp+65083@code.staging.launchpad.net

Commit message

[r=henninge][no-qa] Improve/generalize bugtracker_component tests a bit.

Description of the change

Test code refactoring for components. These mostly comprise Jeroen's suggestions from another branch review, split out for merge simplification.

To post a comment you must log in.
Revision history for this message
Henning Eggers (henninge) wrote :
Download full text (7.1 KiB)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Bryce,
thank you for this nice refactoring. I really like this style when writing
tests. I only have to small issues that I ask you to fix before landing this.
Can you land yourself or do you need me to do that for you?

  review approve

Cheers,
Henning

Am 18.06.2011 06:47, schrieb Bryce Harrington:
> === modified file 'lib/lp/bugs/browser/tests/test_bugtracker_component.py'
> --- lib/lp/bugs/browser/tests/test_bugtracker_component.py 2011-06-03 05:47:32 +0000
> +++ lib/lp/bugs/browser/tests/test_bugtracker_component.py 2011-06-18 04:47:25 +0000
> @@ -40,13 +40,18 @@
> 'field.actions.save': 'Save',
> }
>
> + def _makeComponent(self, name):
> + return self.factory.makeBugTrackerComponent(name, self.comp_group)
> +
> + def _makeUbuntuSourcePackage(self, package_name):
> + distro = getUtility(IDistributionSet).getByName('ubuntu')
> + return self.factory.makeDistributionSourcePackage(
> + sourcepackagename=package_name, distribution=distro)
> +
> def test_view_attributes(self):
> - component = self.factory.makeBugTrackerComponent(
> - u'Example', self.comp_group)
> - distro = getUtility(IDistributionSet).getByName('ubuntu')
> - package = self.factory.makeDistributionSourcePackage(
> - sourcepackagename='example', distribution=distro)
> - form = self._makeForm(package)
> + component = self._makeComponent(u'Example')
> + dsp = self._makeUbuntuSourcePackage('example')
> + form = self._makeForm(dsp)
> view = create_initialized_view(
> component, name='+edit', form=form)
> label = 'Link a distribution source package to Example component'
> @@ -58,33 +63,38 @@
> self.assertEqual(url, view.cancel_url)
>
> def test_linking(self):
> - component = self.factory.makeBugTrackerComponent(
> - u'Example', self.comp_group)
> - distro = getUtility(IDistributionSet).getByName('ubuntu')
> - package = self.factory.makeDistributionSourcePackage(
> - sourcepackagename='example', distribution=distro)
> + component = self._makeComponent(u'Example')
> + dsp = self._makeUbuntuSourcePackage('example')
> + form = self._makeForm(dsp)
>
> self.assertIs(None, component.distro_source_package)
> - form = self._makeForm(package)
> + view = create_initialized_view(
> + component, name='+edit', form=form)
> + notifications = view.request.response.notifications

This line seems to be dead code, you can remove it.

> + self.assertEqual(dsp, component.distro_source_package)
> +
> + def test_linking_notifications(self):
> + component = self._makeComponent(u'Example')
> + dsp = self._makeUbuntuSourcePackage('example')
> + form = self._makeForm(dsp)
> +
> view = create_initialized_view(
> component, name='+edit', form=form)
> self.assertEqual([], view.errors)
> -
> notifications = view.request.response.notifications
> - self.assertEqual(component.distro_source_package,...

Read more...

review: Approve
Revision history for this message
Bryce Harrington (bryce) wrote :

Hi Henning, thanks I've made those two changes.

I am able to land the branch however, when I attempt to do so I get this error:

 ./utilities/ec2 land
 ec2: ERROR: Merge proposal is not approved. Get it approved, or use --force to land it without approval.

So I'd appreciate it if either you'd land it or let me know what else I'd need to do to get it to land for me.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
The diff is not available at this time. You can reload the page or download it.