Ignore:
Timestamp:
Feb 12, 2011, 11:16:02 PM (11 years ago)
Author:
Ralph Meijer <ralphm@…>
Branch:
default
Message:

Catch KeyError? for unsupported verbs in legacy PubSubService? usage.

Author: ralphm.
Fixes: #70.

Because requests are now parsed by PubSubRequest?, it can happen that a request
is succesfully parsed, but there is no legacy handler available. This used
to raise a KeyError?, resulting in a internal-server-error being returned.
Now it returns a feature-not-implemented error.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wokkel/test/test_pubsub.py

    r93 r94  
    38023802
    38033803
     3804    def test_unknown(self):
     3805        """
     3806        Unknown verb yields unsupported error.
     3807        """
     3808        xml = """
     3809        <iq type='get' to='pubsub.example.org'
     3810                       from='user@example.org'>
     3811          <pubsub xmlns='http://jabber.org/protocol/pubsub#owner'>
     3812            <affiliations node='test'/>
     3813          </pubsub>
     3814        </iq>
     3815        """
     3816
     3817        def cb(result):
     3818            self.assertEquals('feature-not-implemented', result.condition)
     3819            self.assertEquals('unsupported', result.appCondition.name)
     3820            self.assertEquals(NS_PUBSUB_ERRORS, result.appCondition.uri)
     3821
     3822        d = self.handleRequest(xml)
     3823        self.assertFailure(d, error.StanzaError)
     3824        d.addCallback(cb)
     3825        return d
     3826
     3827
    38043828
    38053829class PubSubResourceTest(unittest.TestCase):
Note: See TracChangeset for help on using the changeset viewer.