summaryrefslogtreecommitdiff
path: root/src/leap/testing/basetest.py
diff options
context:
space:
mode:
authorkali <kali@leap.se>2012-08-27 06:37:10 +0900
committerkali <kali@leap.se>2012-08-27 06:37:10 +0900
commit10292cac27bc2f10e2b5768c84091a73105bc495 (patch)
treefa232d1c1fb560c1364ec035a16a49d9deb8decd /src/leap/testing/basetest.py
parent2bbe0e0a2d852a1a7261b2fa927eab6e8f41c8c3 (diff)
make eipconductor test use BaseLeapTest
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)