~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/answers/tests/test_question_notifications.py

  • Committer: Curtis Hovey
  • Date: 2011-04-23 01:31:22 UTC
  • mto: This revision was merged to the branch mainline in revision 12915.
  • Revision ID: curtis.hovey@canonical.com-20110423013122-nux6fd83vld9mm82
Removed unneeded tests for the simpler method.

Show diffs side-by-side

added added

removed removed

Lines of Context:
80
80
        self.assertEqual(
81
81
            "body -- mdash\n-- \nrationale", formatted_body)
82
82
 
83
 
    def test_getSubject_no_new_message(self):
 
83
    def test_getSubject(self):
84
84
        """getSubject() when there is no message added to the question."""
85
85
        self.assertEquals(
86
 
            '[Question #1]: Question title', self.notification.getSubject())
87
 
 
88
 
    def test_getSubject_new_message(self):
89
 
        """Test getSubject() when there is a new message."""
90
 
        self.notification.new_message = StubQuestionMessage()
91
 
        self.assertEquals(
92
 
            '[Question #1]: Message subject',
93
 
            self.notification.getSubject())
94
 
 
95
 
    def test_getSubject_new_message_with_reply_prefix(self):
96
 
        """getSubject() when there is a new message with a reply prefix."""
97
 
        self.notification.new_message = StubQuestionMessage(
98
 
            'RE: Message subject')
99
 
        self.assertEquals('RE: [Question #1]: Message subject',
100
 
            self.notification.getSubject())
101
 
 
102
 
        self.notification.new_message.subject = 'Re: Message subject'
103
 
        self.assertEquals('Re: [Question #1]: Message subject',
104
 
            self.notification.getSubject())
105
 
 
106
 
        self.notification.new_message.subject = 're: Message subject'
107
 
        self.assertEquals('re: [Question #1]: Message subject',
108
 
            self.notification.getSubject())
109
 
 
110
 
    def test_getSubject_with_existing_prefix(self):
111
 
        """Test getSubject() when there is already a [Question #xx] prefix."""
112
 
        self.notification.new_message = StubQuestionMessage(
113
 
            '[Question #1]: Question title')
114
 
        self.assertEquals('[Question #1]: Question title',
115
 
            self.notification.getSubject())
116
 
 
117
 
        self.notification.new_message.subject = (
118
 
            'Re: [Question #1]: Message subject')
119
 
        self.assertEquals(
120
 
            'Re: [Question #1]: Message subject',
121
 
            self.notification.getSubject())
122
 
 
123
 
    def test_getSubject_old_prefix(self):
124
 
        """Test that getSubject() with an old [Support #dd] prefix."""
125
 
        self.notification.new_message = StubQuestionMessage(
126
 
            'Re: [Support #1]: Message subject')
127
 
        self.assertEquals(
128
 
            'Re: [Question #1]: Message subject',
 
86
            'Re: [Question #1]: Question title',
129
87
            self.notification.getSubject())
130
88
 
131
89
    def test_user_is_event_user(self):