From 10292cac27bc2f10e2b5768c84091a73105bc495 Mon Sep 17 00:00:00 2001 From: kali Date: Mon, 27 Aug 2012 06:37:10 +0900 Subject: make eipconductor test use BaseLeapTest --- src/leap/testing/basetest.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'src/leap/testing/basetest.py') diff --git a/src/leap/testing/basetest.py b/src/leap/testing/basetest.py index 8d9264f1..881f56c9 100644 --- a/src/leap/testing/basetest.py +++ b/src/leap/testing/basetest.py @@ -9,6 +9,7 @@ except ImportError: import unittest from leap.base.config import get_username, get_groupname +from leap.util.fileutil import mkdir_p, check_and_fix_urw_only _system = platform.system() @@ -64,3 +65,19 @@ class BaseLeapTest(unittest.TestCase): "This test is not implemented " "for the running platform: %s" % _system) + + def touch(self, filepath): + folder, filename = os.path.split(filepath) + if not os.path.isdir(folder): + mkdir_p(folder) + # XXX should move to test_basetest + self.assertTrue(os.path.isdir(folder)) + + with open(filepath, 'w') as fp: + fp.write(' ') + + # XXX should move to test_basetest + self.assertTrue(os.path.isfile(filepath)) + + def chmod600(self, filepath): + check_and_fix_urw_only(filepath) -- cgit v1.2.3