def test_raw_output(self):
mock_pdb = mock.NonCallableMock()
mock_pdb.fact_contents = mock.Mock(return_value=[
{
'value': 14,
'certname': 'alpha',
'environment': 'production',
'path': ['system_uptime', 'days'],
'name': 'system_uptime',
},
])
out = self._query_fact_contents(
mock_pdb, 'foo=bar', ['system_uptime.days'], True)
mock_pdb.fact_contents.assert_called_once_with(query=json.dumps([
'and',
['in', 'certname',
['extract', 'certname',
['select_fact_contents',
['and',
['=', 'path', ['foo']],
['=', 'value', 'bar']]]]],
['or',
['=', 'path',
['system_uptime', 'days']]]]))
self.assertEquals(out, mock_pdb.fact_contents.return_value)
评论列表
文章目录