def test_assert_inventory_and_check_works_with_check_output(mocker): check_output = '<<<arr>>>' fake_item = 'one more thing' fake_inventory = [(None, None), (fake_item, None), (None, 'default_params')] fake_check_result = (0, 'OK') fake_params = 42 mocker.patch('pytest_check_mk.assertions.assert_well_formed_inventory') mocker.patch('pytest_check_mk.assertions.assert_well_formed_check_result') fake_check = mocker.Mock() fake_check.inventory = mocker.MagicMock(return_value=fake_inventory) fake_check.check = mocker.MagicMock(return_value=fake_check_result) fake_check.check_file.module.default_params = fake_params assertions.assert_inventory_and_check_works_with_check_output(fake_check, check_output) assertions.assert_well_formed_inventory.assert_called_once_with(fake_check, fake_inventory) fake_check.check.assert_has_calls([ call(None, None, check_output), call(fake_item, None, check_output), call(None, fake_params, check_output), ]) assertions.assert_well_formed_check_result.assert_has_calls([ call(fake_check, fake_check_result), call(fake_check, fake_check_result), call(fake_check, fake_check_result), ])
def test_with_fake_agent_output(agents, check): assert_inventory_and_check_works_with_check_output(check, agents['plugins/printer_inklevels'].run('--fake-data'))
def test_consistency(check): assert_inventory_and_check_works_with_check_output(check, check_output)