def test_save_data_to_file_not_pretty(tmpdir): f = tmpdir.join("test") path = "%s" % f data = { "asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", "1asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", "2asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", "3asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", "4asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", "5asdasaaaaaaaaaaaaaaaaaaaad": "asbbbbbbbbbbbbbbbbbbd", } store.save_data_to_file(path, data, pretty=False) assert file(path).read().count("\n") == 1 assert store.load_data_from_file(path) == data
def save_gui_messages(messages, user_id=None): if user_id is None: user_id = config.user.id path = config.config_dir + "/" + user_id.encode("utf-8") + '/messages.mk' make_nagios_directory(os.path.dirname(path)) store.save_data_to_file(path, messages)
def save_acknowledgements(acknowledged_werks): store.save_data_to_file(acknowledgement_path, acknowledged_werks)
def test_save_data_to_file(tmpdir): f = tmpdir.join("test") path = "%s" % f store.save_data_to_file(path, [2, 3]) assert store.load_data_from_file(path) == [2, 3]
def save_gui_messages(messages, user_id = None): if user_id is None: user_id = config.user.id path = config.config_dir + "/" + user_id.encode("utf-8") + '/messages.mk' make_nagios_directory(os.path.dirname(path)) store.save_data_to_file(path, messages)