Beispiel #1
0
    def test_not_found_exception(self):
        '''Test a failing 'get' call'''

        expected = protocol.build_prologue(self.CLUSTER_ID)
        expected += ''.join(protocol.Get(False, 'key').serialize())
        to_send = ''.join(chr(i) for i in itertools.chain(
            (errors.NotFound.CODE, 0, 0, 0),
            (3, 0, 0, 0),
            bytes_('key'),
        ))

        client = self._create_client(_FakeTransport(self, expected, to_send))

        deferred = client.get('key')
        deferred.addErrback(lambda exc: exc.trap(errors.NotFound))

        return deferred
Beispiel #2
0
    def test_scenario(self):
        client = self._create_nursery_client()

        client.set('key', 'value')
        self.assertEqual(client.get('key'), 'value')
        client.delete('key')
Beispiel #3
0
    def test_scenario(self):
        client = self._create_nursery_client()

        client.set('key', 'value')
        self.assertEqual(client.get('key'), 'value')
        client.delete('key')