|
Revision 64, 1.0 kB
(checked in by mk, 6 years ago)
|
Check that Cheesecake is leaving log file when package is broken and is removing it otherwise (closes ticket #29).
|
- Property svn:eol-style set to
native
- Property svn:keywords set to
Author Date Id Revision
|
| Line | |
|---|
| 1 |
|
|---|
| 2 |
import os |
|---|
| 3 |
import tempfile |
|---|
| 4 |
|
|---|
| 5 |
from _helper_cheesecake import FunctionalTest, read_file_contents, PACKAGE_PATH, INVALID_PACKAGE_PATH |
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
class TestLogfile(FunctionalTest): |
|---|
| 9 |
def setUp(self): |
|---|
| 10 |
self.logfile = tempfile.mktemp(prefix='log') |
|---|
| 11 |
|
|---|
| 12 |
def tearDown(self): |
|---|
| 13 |
super(self.__class__, self).tearDown() |
|---|
| 14 |
if os.path.exists(self.logfile): |
|---|
| 15 |
os.unlink(self.logfile) |
|---|
| 16 |
|
|---|
| 17 |
def test_valid_package(self): |
|---|
| 18 |
self._run_cheesecake('--path %s --logfile %s' % \ |
|---|
| 19 |
(PACKAGE_PATH, self.logfile)) |
|---|
| 20 |
|
|---|
| 21 |
self._assert_success() |
|---|
| 22 |
|
|---|
| 23 |
# After successful installation there's no need to keep a logfile. |
|---|
| 24 |
assert not os.path.exists(self.logfile) |
|---|
| 25 |
|
|---|
| 26 |
def test_broken_package(self): |
|---|
| 27 |
self._run_cheesecake('--path %s --logfile %s' % \ |
|---|
| 28 |
(INVALID_PACKAGE_PATH, self.logfile)) |
|---|
| 29 |
|
|---|
| 30 |
# Package is broken, but error was handled. |
|---|
| 31 |
self._assert_success() |
|---|
| 32 |
|
|---|
| 33 |
# Unpacking failed - logfile should have been left. |
|---|
| 34 |
assert os.path.exists(self.logfile) |
|---|