twisted.test.iosim.makeFakeServer

Here are the examples of the python api twisted.test.iosim.makeFakeServer taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

Example 1

Project: vertex Source File: test_standalone.py
    def test_adds_user(self):
        """
        When L{UserAdder} is connected to L{IdentityAdmin}, the L{AddUser}
        command is called and L{IdentityAdmin} adds the user to its factory's
        store.
        """
        admin = IdentityAdmin()
        admin.factory = self.adminFactory

        serverTransport = makeFakeServer(admin)
        serverTransport.getQ2QHost = lambda: Q2QAddress('Q2Q Host')

        client = AMP()
        pump = connect(admin, serverTransport, client, makeFakeClient(client))

        d = client.callRemote(AddUser, name='q2q username',
                              password='q2q password')
        pump.flush()

        # the username and password are added, along with the domain=q2q
        # host, to the IdentityAdmin's factory's store
        self.assertEqual([call('Q2Q Host', 'q2q username', 'q2q password')],
                         self.addUser.calls)

        # the server responds with {}
        self.assertEqual({}, self.successResultOf(d))