pycassa/pycassa — pull request #185 by eyalr (2013-01-18 19:01:50+00:00)
Title: Adding stub objects for ColumnFamily, ConnectionPool, and SystemManager

A functional set of stubs to be used for unit testing.

Projects that use pycassa and need to run an automated unit test suite on a
system like Jenkins can use these stubs to emulate interactions with Cassandra
without spinning up a cluster locally.

Example usage:
```python
>>> from pycassa.contrib.stubs import ColumnFamilyStub, ConnectionPoolStub
>>> p = ConnectionPoolStub('localhost')
>>> cf = ColumnFamilyStub(p, 'TestCF')
>>> 'TestCF' in p.column_families
True
>>> cf.insert(1234, {'test_column': 5})
>>> cf.insert(5678, {'test_column': 10}, timestamp=5678)
>>> cf.get(1234)
OrderedDict([('test_column', 5)])
>>> cf.get(5678)
OrderedDict([('test_column', 10)])
>>> cf.get(1234, include_timestamp=True)
OrderedDict([('test_column', (5, 1358375073016192))])
>>> cf.get(5678, include_timestamp=True)
OrderedDict([('test_column', (10, 5678))])
>>> from pycassa import index
>>> index_clause = index.create_index_clause([index.create_index_expression('test_column', 6, index.GT)])
>>> cf.get_indexed_slices(index_clause)
[(5678, OrderedDict([('test_column', 10)]))]
```