summaryrefslogtreecommitdiff
path: root/systest
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2011-06-28 20:21:07 +0100
committerLars Wirzenius <liw@liw.fi>2011-06-28 20:21:07 +0100
commitfc92a206b0a95dec76875fff47b7cb8e08b4628f (patch)
tree7c170f0403a234e35f40f08567ab54f175fedead /systest
parent3cf9f76a23ce40aa1e9c50abeafd4f8457785faf (diff)
downloadsystest-fc92a206b0a95dec76875fff47b7cb8e08b4628f.tar.gz
Load tests from files instead of including them in the code.
Diffstat (limited to 'systest')
-rwxr-xr-xsystest47
1 files changed, 1 insertions, 46 deletions
diff --git a/systest b/systest
index bf650b5..d6fed0c 100755
--- a/systest
+++ b/systest
@@ -9,46 +9,9 @@ import unittest
import systest
-class DebianBaseTests(systest.TestCase):
-
- def test_only_ssh_port(self):
- out = self.hostcmd(['nmap', self.settings['target']])
- ports = [line.split()[0]
- for line in out.splitlines()
- if ' open ' in line]
- self.assertEqual(ports, ['22/tcp'])
-
- def test_ssh_login(self):
- user = self.settings['user']
- out = self.hostcmd(['ssh', '-l', user, self.settings['target'], 'id'])
- self.assertMatches(r'^uid=1000\(%s\)' % user, out)
-
- def test_simple_dns_lookup(self):
- out = self.targetcmd(['host', 'www.debian.org'])
- self.assert_('www.debian.org' in out)
-
- def test_ping_localhost(self):
- self.targetcmd(['ping', '-c1', 'localhost'])
-
- def test_ping6_localhost(self):
- self.targetcmd(['ping6', '-c1', 'ip6-localhost'])
-
- def test_cat(self):
- out = self.targetcmd(['cat'], stdin='foo')
- self.assertEqual(out, 'foo')
-
-# def test_sudo(self):
-# out = self.targetcmd(['sudo', 'id'],
-# stdin=self.settings['user-password'])
-# self.assertMatches(r'^uid=0\(root\)', out)
-
-
-
class SystemTest(cliapp.Application):
def add_settings(self):
- self.settings.boolean(['verbose', 'v'],
- 'print names of tests when run')
self.settings.string(['target'], 'target domain name or IP address')
self.settings.string(['user'], 'user on target')
self.settings.string(['user-password'], 'password for target user')
@@ -56,7 +19,7 @@ class SystemTest(cliapp.Application):
def process_args(self, args):
loader = unittest.defaultTestLoader
loader.suiteClass = self.create_suite
- suite = loader.loadTestsFromTestCase(DebianBaseTests)
+ suite = loader.loadTestsFromNames(args)
unittest.TextTestRunner().run(suite)
def create_suite(self, tests):
@@ -65,14 +28,6 @@ class SystemTest(cliapp.Application):
suite = unittest.TestSuite(tests)
return suite
- def mangle(self, testname):
- return 'test_' + testname.replace('-', '_')
-
- def unmangle(self, methodname):
- assert methodname.startswith('test_')
- methodname = methodname[len('test_'):]
- return methodname.replace('_', '-')
-
if __name__ == '__main__':
SystemTest().run()