class RestHelperTest(unittest.TestCase):
    def setUp(self):
        self.host = config['node-1']['host']
        self.port = config['node-1']['port']
        self.username = config['node-1']['username']
        self.password = config['node-1']['password']
        self.bucket_name = config['node-1']['bucket']

        server_info = {
            "ip": self.host,
            "port": self.port,
            "username": self.username,
            "password": self.password
        }
        self.rest = RestConnection(server_info)
        self.rest_helper = None

    def tearDown(self):
        pass

    @nottest
    def setup_rest_helper(self):
        self.rest_helper = RestHelper(self.rest)

    @attr(cbv="1.8.0")
    def test_rest_helper_object_creation(self):
        self.setup_rest_helper()
        self.assertEqual(self.rest, self.rest_helper.rest)

    @attr(cbv="1.8.0")
    def test_is_ns_server_running(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.is_ns_server_running())

    @attr(cbv="1.8.0")
    def test_is_cluster_healthy(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.is_cluster_healthy())

    @attr(cbv="1.8.0")
    def test_vbucket_map_ready(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.vbucket_map_ready(self.bucket_name))

    @attr(cbv="1.8.0")
    def test_bucket_exists(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.bucket_exists(self.bucket_name))
        self.assertFalse(self.rest_helper.bucket_exists(str(uuid.uuid4())))

    @attr(cbv="1.8.0")
    def test_all_nodes_replicated(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.all_nodes_replicated(debug=True))
class RestHelperTest(unittest.TestCase):
    def setUp(self):
        self.host = config['node-1']['host']
        self.port = config['node-1']['port']
        self.username = config['node-1']['username']
        self.password = config['node-1']['password']
        self.bucket_name = config['node-1']['bucket']

        server_info = {"ip": self.host,
                       "port": self.port,
                       "username": self.username,
                       "password": self.password}
        self.rest = RestConnection(server_info)
        self.rest_helper = None

    def tearDown(self):
        pass

    @attr(cbv="2.0.0")
    def setup_rest_helper(self):
        self.rest_helper = RestHelper(self.rest)

    @attr(cbv="2.0.0")
    def test_rest_helper_object_creation(self):
        self.setup_rest_helper()
        self.assertEqual(self.rest, self.rest_helper.rest)

    @attr(cbv="2.0.0")
    def test_is_ns_server_running(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.is_ns_server_running())

    @attr(cbv="2.0.0")
    def test_is_cluster_healthy(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.is_cluster_healthy())

    @attr(cbv="2.0.0")
    def test_vbucket_map_ready(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.vbucket_map_ready(self.bucket_name))

    @attr(cbv="2.0.0")
    def test_bucket_exists(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.bucket_exists(self.bucket_name))
        self.assertFalse(self.rest_helper.bucket_exists(str(uuid.uuid4())))

    @attr(cbv="2.0.0")
    def test_all_nodes_replicated(self):
        self.setup_rest_helper()
        self.assertTrue(self.rest_helper.all_nodes_replicated(debug=True))