1
# -*- Mode: Python; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4 -*-
3
# Copyright 2008 Michael Terry <mike@mterry.name>
5
# This file is part of duplicity.
7
# Duplicity is free software; you can redistribute it and/or modify it
8
# under the terms of the GNU General Public License as published by the
9
# Free Software Foundation; either version 3 of the License, or (at your
10
# option) any later version.
12
# Duplicity is distributed in the hope that it will be useful, but
13
# WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
# General Public License for more details.
17
# You should have received a copy of the GNU General Public License
18
# along with duplicity; if not, write to the Free Software Foundation,
19
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24
class LogTest(unittest.TestCase):
25
"""Test machine-readable functions/classes in log.py"""
27
duplicity_bin = "../duplicity-bin"
29
def test_command_line_error(self):
30
"""Check notification of a simple error code"""
32
# Run actual duplicity command (will fail, because no arguments passed)
33
os.system("%s --log-file=/tmp/duplicity.log >/dev/null 2>&1" % self.duplicity_bin)
35
# The format of the file should be:
41
f = open('/tmp/duplicity.log', 'r')
48
assert(line == "ERROR 2\n")
50
assert(line.startswith(". "))
56
if __name__ == "__main__":