Start of Cluster unit/integration tests

This commit is contained in:
Tyler Hobbs
2013-05-02 14:13:18 -05:00
parent ee75215026
commit 28aee41ef9

37
tests/test_cluster.py Normal file
View File

@@ -0,0 +1,37 @@
import unittest
from cassandra.cluster import Cluster
class ClusterTests(unittest.TestCase):
def testBasic(self):
cluster = Cluster()
session = cluster.connect()
result = session.execute(
"""
CREATE KEYSPACE clustertests
WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}
""")
self.assertEquals(None, result)
result = session.execute(
"""
CREATE TABLE clustertests.cf0 (
a text,
b text,
c text,
PRIMARY KEY (a, b)
)
""")
self.assertEquals(None, result)
result = session.execute(
"""
INSERT INTO clustertests.cf0 (a, b, c) VALUES ('a', 'b', 'c')
""")
self.assertEquals(None, result)
result = session.execute("SELECT * FROM clustertests.cf0")
self.assertEquals([{'a': 'a', 'b': 'b', 'c': 'c'}], result)
cluster.shutdown()