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')
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")
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")
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"