Part of our test case looks like this.  Notice the fake out of the
Method response below?  It took some time to discover it by
inspection.  Is there an easier way to mock the response stuff from
the middleware?


        method = FakeMethod()
        msg = Message(method, {}, content)
        msg.delivery_tag = 'abc'

        chan = FakeChannel()

        protocol._dispatchMessage(msg, chan)

        self.assertTrue(...


# Grossly fake out some nasty amqp guts.
class FakeFields:
    class bypyname:
        def __getitem__(self, name):
            return name
    bypyname = bypyname()

    def __getitem__(self, key):
        return key

    def index(self, name):
        return name


class FakeMethod:
    def __init__(self):
        self.fields = FakeFields()



class FakeChannel:
    def basic_ack(self, *a, **kw):
        pass


-Nate

_______________________________________________
Mailing list: https://launchpad.net/~txamqp-dev
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~txamqp-dev
More help   : https://help.launchpad.net/ListHelp

Reply via email to