Example #1
0
    def test_05_decode_request(self):
        basilic=self.basilic

        tags=[("AND","python"),("AND","zope")] # Supposed translations of "python+zope"

        self.assertEqual(
            decoder.decode_request(basilic,["user1","tags","python+zope"]),
            ("user1",None,tags,"xml")
        )

        self.assertEqual(
            decoder.decode_request(basilic,["user1","tags","python+zope","csv"]),
            ("user1",None,tags,"csv")
        )

        self.assertEqual(
            decoder.decode_request(basilic,["user1","tags","python+zope","xxx"]),
            ("user1",None,tags,"xml")
        )

        self.assertEqual(
            decoder.decode_request(basilic,["odeckmyn","tags","python+zope"]),
            (None,None,tags,"xml")
        )

        self.assertEqual(
            decoder.decode_request(basilic,["My Public Bookmarks","tags","python+zope"]),
            (None,"My Public Bookmarks",tags,"xml")
        )

        self.assertEqual(
            decoder.decode_request(basilic,["user1", "My Bookmarks","tags","python+zope"]),
            ("user1","My Bookmarks",tags,"xml")
        )

        self.assertEqual(
            decoder.decode_request(basilic,[]),
            (None,None,[],"xml")
        )
 def exec_request(self, stream, params=None):
     """Executes a "request" operation. Result is sent trough stream."""
     (userlogin,userbase,tags,format)=decoder.decode_request(params)
     api.operation_request(self.server.basilic, stream, params)