Skip to content

Commit

Permalink
Removing custom defaults on HappyBase connection tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dhermes committed Sep 5, 2015
1 parent 5feba43 commit a8d295e
Showing 1 changed file with 31 additions and 14 deletions.
45 changes: 31 additions & 14 deletions gcloud_bigtable/happybase/test_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,16 +77,16 @@ def _getTargetClass(self):
return Connection

def _makeOne(self, *args, **kwargs):
if 'cluster' not in kwargs:
kwargs['cluster'] = _Cluster()
return self._getTargetClass()(*args, **kwargs)

def test_constructor_defaults(self):
with self.assertRaises(NotImplementedError):
self._makeOne()
cluster = _Cluster() # Avoid implicit environ check.
self._makeOne(cluster=cluster)

def test_constructor_no_autoconnect(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)
self.assertEqual(connection.table_prefix, None)
self.assertEqual(connection.table_prefix_separator, '_')

Expand Down Expand Up @@ -159,61 +159,78 @@ def test_constructor_with_protocol(self):
self._makeOne(protocol=object())

def test_open(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)
with self.assertRaises(NotImplementedError):
connection.open()

def test_close(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)
with self.assertRaises(NotImplementedError):
connection.close()

def test_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
use_prefix = False
with self.assertRaises(NotImplementedError):
connection.table(name, use_prefix=use_prefix)

def test_tables(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)
with self.assertRaises(NotImplementedError):
connection.tables()

def test_create_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
families = {}
with self.assertRaises(NotImplementedError):
connection.create_table(name, families)

def test_delete_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
disable = True
with self.assertRaises(NotImplementedError):
connection.delete_table(name, disable=disable)

def test_enable_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.enable_table(name)

def test_disable_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.disable_table(name)

def test_is_table_enabled(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
with self.assertRaises(NotImplementedError):
connection.is_table_enabled(name)

def test_compact_table(self):
connection = self._makeOne(autoconnect=False)
cluster = _Cluster() # Avoid implicit environ check.
connection = self._makeOne(autoconnect=False, cluster=cluster)

name = 'table-name'
major = True
with self.assertRaises(NotImplementedError):
Expand Down

0 comments on commit a8d295e

Please sign in to comment.