예제 #1
0
 def test_get_object_id_by_params(self):
     '''
     Test get_object_id function with expected result from API call
     '''
     with patch('salt.modules.zabbix.run_query',
                MagicMock(return_value=GETID_QUERY_RESULT_OK)):
         self.assertEqual(
             zabbix.get_object_id_by_params('hostgroup', 'Databases'), '11')
예제 #2
0
 def test_get_object_id_by_params(self):
     """
     Test get_object_id function with expected result from API call
     """
     with patch(
             "salt.modules.zabbix.run_query",
             MagicMock(return_value=GETID_QUERY_RESULT_OK),
     ):
         self.assertEqual(
             zabbix.get_object_id_by_params("hostgroup", "Databases"), "11")
예제 #3
0
def test_get_obj_id_by_params_fail(run_query_bad):
    """
    Test get_object_id function with unexpected result from API call
    """
    with pytest.raises(SaltException):
        assert zabbix.get_object_id_by_params("hostgroup", "Databases")
예제 #4
0
def test_get_object_id_by_params(run_query_ok):
    """
    Test get_object_id function with expected result from API call
    """
    assert zabbix.get_object_id_by_params("hostgroup", "Databases") == "11"