Merge lp:~bkerensa/launchpad/fix-for-1044457 into lp:launchpad

Proposed by Benjamin Kerensa
Status: Rejected
Rejected by: Curtis Hovey
Proposed branch: lp:~bkerensa/launchpad/fix-for-1044457
Merge into: lp:launchpad
Diff against target: 12 lines (+1/-1)
1 file modified
lib/lp/registry/browser/team.py (+1/-1)
To merge this branch: bzr merge lp:~bkerensa/launchpad/fix-for-1044457
Reviewer Review Type Date Requested Status
Steve Kowalik (community) code Needs Fixing
Review via email: mp+122437@code.launchpad.net

Commit message

Changed TeamEditView to IntWidget

Description of the change

Changed TeamEditView to IntWidget

To post a comment you must log in.
Revision history for this message
Steve Kowalik (stevenk) wrote :

Hi Benjamin,

This looks like great work, except that Launchpad has a policy that every code change has test coverage, and it's clear from the previous MP for this branch that it does not. I would suggest making use of the test that Curtis Hovey linked in the previous review.

This branch also introduces an unused import, since lib/lp/registry/browser/team.py no longer makes use of StrippedTextWidget.

review: Needs Fixing (code)
Revision history for this message
Curtis Hovey (sinzui) wrote :

Benjamin, You didn't need to delete the first merge proposal. You only needed to make the changes I suggested, and push and as for a new review. Per my first review:

Open lib/lp/registry/browser/tests/test_team.py and paste this test at the end of TestTeamEditView

    def test_expiration_and_renewal(self):
        # The team's membership expiration and renewal rules can be set.
        owner = self.factory.makePerson()
        team = self.factory.makeTeam(name="team", owner=owner)
        form = {
            'field.name': team.name,
            'field.displayname': team.displayname,
            'field.defaultmembershipperiod': '180',
            'field.defaultrenewalperiod': '365',
            'field.membership_policy': 'RESTRICTED',
            'field.renewal_policy': 'ONDEMAND',
            'field.actions.save': 'Save',
            }
        login_person(owner)
        view = create_initialized_view(team, '+edit', form=form)
        self.assertEqual(0, len(view.errors))
        self.assertEqual(
            TeamMembershipPolicy.RESTRICTED, team.membership_policy)
        self.assertEqual(180, team.defaultmembershipperiod)
        self.assertEqual(365, team.defaultrenewalperiod)
        self.assertEqual(
            TeamMembershipRenewalPolicy.ONDEMAND, team.renewal_policy)

^ This test failed like the screenshot. Your widget fix should permit this test to pass.
After your commit, run

    make lint

To verify your changes are clean and maintainable.

Revision history for this message
Curtis Hovey (sinzui) wrote :

Benjamin, also per my first email, you can run the test case this way.
    ./bin/test -vvc -t TestTeamEditView lp.registry.browser.tests.test_team

Unmerged revisions

15898. By Benjamin Kerensa

Changed TeamEditView Custom Widget to IntWidget

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'lib/lp/registry/browser/team.py'
2--- lib/lp/registry/browser/team.py 2012-08-15 22:01:39 +0000
3+++ lib/lp/registry/browser/team.py 2012-09-03 05:11:21 +0000
4@@ -299,7 +299,7 @@
5
6 custom_widget(
7 'renewal_policy', LaunchpadRadioWidget, orientation='vertical')
8- custom_widget('defaultrenewalperiod', StrippedTextWidget,
9+ custom_widget('defaultrenewalperiod', IntWidget,
10 widget_class='field subordinate')
11 custom_widget(
12 'membership_policy', LaunchpadRadioWidgetWithDescription,