~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/app/browser/tests/test_inlineeditpickerwidget.py

  • Committer: Ian Booth
  • Date: 2011-07-27 05:05:46 UTC
  • mto: This revision was merged to the branch mainline in revision 13532.
  • Revision ID: ian.booth@canonical.com-20110727050546-1y2m0vl74i0ul8dl
Fix failing tests

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
        widget = self.getWidget(vocabulary='UserTeamsParticipation')
46
46
        self.assertFalse(widget.config['show_search_box'])
47
47
 
48
 
    def test_required_fields_dont_have_a_remove_link(self):
49
 
        widget = self.getWidget(vocabulary='ValidPersonOrTeam', required=True)
50
 
        self.assertFalse(widget.config['show_remove_button'])
51
 
 
52
 
    def test_optional_fields_do_have_a_remove_link(self):
53
 
        widget = self.getWidget(
54
 
            vocabulary='ValidPersonOrTeam', required=False)
55
 
        self.assertTrue(widget.config['show_remove_button'])
56
 
 
57
 
    def test_assign_me_exists_if_user_in_vocabulary(self):
58
 
        widget = self.getWidget(vocabulary='ValidPersonOrTeam', required=True)
59
 
        login_person(self.factory.makePerson())
60
 
        self.assertTrue(widget.config['show_assign_me_button'])
61
 
 
62
 
    def test_assign_me_not_shown_if_user_not_in_vocabulary(self):
63
 
        widget = self.getWidget(vocabulary='TargetPPAs', required=True)
64
 
        login_person(self.factory.makePerson())
65
 
        self.assertFalse(widget.config['show_assign_me_button'])
66
 
 
67
48
 
68
49
class TestInlinePersonEditPickerWidget(TestCaseWithFactory):
69
50
 
94
75
        widget_value = self.factory.makeTeam()
95
76
        widget = self.getWidget(widget_value, vocabulary='ValidPersonOrTeam')
96
77
        self.assertEquals('team', widget.config['selected_value_metadata'])
 
78
 
 
79
    def test_required_fields_dont_have_a_remove_link(self):
 
80
        widget = self.getWidget(
 
81
            None, vocabulary='ValidPersonOrTeam', required=True)
 
82
        self.assertFalse(widget.config['show_remove_button'])
 
83
 
 
84
    def test_optional_fields_do_have_a_remove_link(self):
 
85
        widget = self.getWidget(
 
86
            None, vocabulary='ValidPersonOrTeam', required=False)
 
87
        self.assertTrue(widget.config['show_remove_button'])
 
88
 
 
89
    def test_assign_me_exists_if_user_in_vocabulary(self):
 
90
        widget = self.getWidget(
 
91
            None, vocabulary='ValidPersonOrTeam', required=True)
 
92
        login_person(self.factory.makePerson())
 
93
        self.assertTrue(widget.config['show_assign_me_button'])
 
94
 
 
95
    def test_assign_me_not_shown_if_user_not_in_vocabulary(self):
 
96
        widget = self.getWidget(
 
97
            None, vocabulary='TargetPPAs', required=True)
 
98
        login_person(self.factory.makePerson())
 
99
        self.assertFalse(widget.config['show_assign_me_button'])