def setUp(self):
super(HBaseManager, self).setUp()
self.connection = storage.get_connection(
self.url, self.conf)
# Unique prefix for each test to keep data is distinguished because
# all test data is stored in one table
data_prefix = uuidutils.generate_uuid(dashed=False)
def table(conn, name):
return mocks.MockHBaseTable(name, conn, data_prefix)
# Mock only real HBase connection, MConnection "table" method
# stays origin.
mock.patch('happybase.Connection.table', new=table).start()
# We shouldn't delete data and tables after each test,
# because it last for too long.
# All tests tables will be deleted in setup-test-env.sh
mock.patch("happybase.Connection.disable_table",
new=mock.MagicMock()).start()
mock.patch("happybase.Connection.delete_table",
new=mock.MagicMock()).start()
mock.patch("happybase.Connection.create_table",
new=mock.MagicMock()).start()
评论列表
文章目录