def test_server_bdds_statistic_state_running(self,
                                              mock_get_snmp_multiple_oid,
                                              mock_server_number_queries,
                                              mock_get_memory_usage,
                                              mock_get_cpu_process):
     """
     :param:
     :return:
     """
     ip = ""  # pylint:disable=invalid-name
     snmp_config_data = None
     var_binds = [('1.2.3.{}'.format(str(i)), 80 + i) for i in range(7)]
     # Mock index = 7 for dns operate state
     var_binds.append(('1.2.3.9', 1))
     mock_get_snmp_multiple_oid.return_value = var_binds
     queries = 5
     mock_server_number_queries.return_value = queries
     server_memory_usage = 5
     mock_get_memory_usage.return_value = server_memory_usage
     server_cpu_usage = 5
     mock_get_cpu_process.return_value = server_cpu_usage
     from statistics_collection.snmp.snmp_methods import server_bdds_statistic  # pylint:disable=import-error
     actual = server_bdds_statistic(ip, snmp_config_data)
     expect = 5, 5, 1, 5
     self.assertEqual(actual, expect)
 def test_server_bdds_statistic_exception(self, mock_get_snmp_multiple_oid,
                                          mock_server_number_queries,
                                          mock_get_memory_usage,
                                          mock_get_cpu_process):
     """
     :param:
     :return:
     """
     ip = ""  # pylint:disable=invalid-name
     snmp_config_data = None
     mock_get_snmp_multiple_oid.side_effect = Exception("exeption")
     mock_server_number_queries.side_effect = Exception("exception")
     mock_get_memory_usage.side_effect = Exception("exeption")
     mock_get_cpu_process.side_effect = Exception("exeption")
     from statistics_collection.snmp.snmp_methods import server_bdds_statistic  # pylint:disable=import-error
     with self.assertRaises(Exception):
         server_bdds_statistic(ip, snmp_config_data)