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 |
Related bugs: |
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_
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.
-----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: bugs/browser/ tests/test_ bugtracker_ component. py' bugs/browser/ tests/test_ bugtracker_ component. py 2011-06-03 05:47:32 +0000 bugs/browser/ tests/test_ bugtracker_ component. py 2011-06-18 04:47:25 +0000 actions. save': 'Save', self, name): makeBugTrackerC omponent( name, self.comp_group) cePackage( self, package_name): IDistributionSe t).getByName( 'ubuntu' ) makeDistributio nSourcePackage( me=package_ name, distribution= distro) attributes( self): makeBugTrackerC omponent( IDistributionSe t).getByName( 'ubuntu' ) makeDistributio nSourcePackage( me='example' , distribution= distro) package) nent(u' Example' ) uSourcePackage( 'example' ) initialized_ view( l(url, view.cancel_url) makeBugTrackerC omponent( IDistributionSe t).getByName( 'ubuntu' ) makeDistributio nSourcePackage( me='example' , distribution= distro) nent(u' Example' ) uSourcePackage( 'example' ) distro_ source_ package) package) initialized_ view( response. notifications
> === modified file 'lib/lp/
> --- lib/lp/
> +++ lib/lp/
> @@ -40,13 +40,18 @@
> 'field.
> }
>
> + def _makeComponent(
> + return self.factory.
> +
> + def _makeUbuntuSour
> + distro = getUtility(
> + return self.factory.
> + sourcepackagena
> +
> def test_view_
> - component = self.factory.
> - u'Example', self.comp_group)
> - distro = getUtility(
> - package = self.factory.
> - sourcepackagena
> - form = self._makeForm(
> + component = self._makeCompo
> + dsp = self._makeUbunt
> + form = self._makeForm(dsp)
> view = create_
> component, name='+edit', form=form)
> label = 'Link a distribution source package to Example component'
> @@ -58,33 +63,38 @@
> self.assertEqua
>
> def test_linking(self):
> - component = self.factory.
> - u'Example', self.comp_group)
> - distro = getUtility(
> - package = self.factory.
> - sourcepackagena
> + component = self._makeCompo
> + dsp = self._makeUbunt
> + form = self._makeForm(dsp)
>
> self.assertIs(None, component.
> - form = self._makeForm(
> + view = create_
> + component, name='+edit', form=form)
> + notifications = view.request.
This line seems to be dead code, you can remove it.
> + self.assertEqua l(dsp, component. distro_ source_ package) notifications( self): nent(u' Example' ) uSourcePackage( 'example' ) initialized_ view( l([], view.errors) response. notifications l(component. distro_ source_ package, ...
> +
> + def test_linking_
> + component = self._makeCompo
> + dsp = self._makeUbunt
> + form = self._makeForm(dsp)
> +
> view = create_
> component, name='+edit', form=form)
> self.assertEqua
> -
> notifications = view.request.
> - self.assertEqua