'Test signals emitted by the comment posting view'

def testCommentSignals(self):

    def receive(sender, **kwargs):
        self.assertEqual(kwargs['comment'].comment, 'This    is    my    comment')
        self.assert_(('request' in kwargs))
        received_signals.append(kwargs.get('signal'))
    received_signals = []
    expected_signals = [signals.comment_will_be_posted, signals.comment_was_posted]
    for signal in expected_signals:
        signal.connect(receive)
    self.testCreateValidComment()
    self.assertEqual(received_signals, expected_signals)
    for signal in expected_signals:
        signal.disconnect(receive)
