'Test auto rejecting subscription requests.'

def testNoAutoAuthorize(self):

    events = set()
    def presence_subscribe(p):
        events.add('presence_subscribe')
    def changed_subscription(p):
        events.add('changed_subscription')
    self.xmpp.add_event_handler('changed_subscription', changed_subscription)
    self.xmpp.add_event_handler('presence_subscribe', presence_subscribe)
    self.xmpp.roster['tester@localhost'].auto_authorize = False
    self.recv('\n                                        <presence    from="user@localhost"\n                                                                                to="tester@localhost"\n                                                                                type="subscribe"    />\n                                ')
    self.send('\n                                        <presence    to="user@localhost"\n                                                                                type="unsubscribed"    />\n                                ')
    expected = set(('presence_subscribe', 'changed_subscription'))
    self.assertEqual(events, expected, ('Incorrect    events    triggered:    %s' % events))
