Example #1
0
    def test_flushAll(self):
        """
        Ensure that we can flush all servers.
        """
        client = YamClient(['one', 'two'], connect=False)
        transports = makeTestConnections(client)

        send = "flush_all\r\n"
        recv = ["OK\r\n", "OK\r\n"]
        results = [(True, True), (True, True)]
        yield self._test(client.flushAll(), transports, send, recv, results)
Example #2
0
    def test_flushAll(self):
        """
        Ensure that we can flush all servers.
        """
        client = YamClient(['one', 'two'], connect=False)
        transports = makeTestConnections(client)

        send = "flush_all\r\n"
        recv = ["OK\r\n", "OK\r\n"]
        results = [(True, True), (True, True)]
        yield self._test(client.flushAll(), transports, send, recv, results)
Example #3
0
    def test_no_servers(self):
        """
        Ensure that exception is thrown if no servers are present.
        """
        client = YamClient([], connect=False)
        transports = makeTestConnections(client)

        # flush should be OK with no servers
        send = "flush_all\r\n"
        recv = ["OK\r\n", "OK\r\n"]
        yield self._test(client.flushAll(), transports, send, recv, [])

        # these, however, shoudl be an issue
        self.assertRaises(NoServerError, client.set, "foo", "bar")
        self.assertRaises(NoServerError, client.get, "foo")
Example #4
0
    def test_no_servers(self):
        """
        Ensure that exception is thrown if no servers are present.
        """
        client = YamClient([], connect=False)
        transports = makeTestConnections(client)

        # flush should be OK with no servers
        send = "flush_all\r\n"
        recv = ["OK\r\n", "OK\r\n"]
        yield self._test(client.flushAll(), transports, send, recv, [])

        # these, however, shoudl be an issue
        self.assertRaises(NoServerError, client.set, "foo", "bar")
        self.assertRaises(NoServerError, client.get, "foo")