summaryrefslogtreecommitdiff
path: root/src/leap/testing/basetest.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/testing/basetest.py')
-rw-r--r--src/leap/testing/basetest.py17
1 files changed, 17 insertions, 0 deletions
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)