From 336afecca5427070ce97155fe6341a0514500e92 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Tue, 28 Jun 2011 20:43:51 +0100 Subject: Add Debian base system tests. --- tests-debian-base-install.py | 51 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 tests-debian-base-install.py (limited to 'tests-debian-base-install.py') diff --git a/tests-debian-base-install.py b/tests-debian-base-install.py new file mode 100644 index 0000000..b2bcfcd --- /dev/null +++ b/tests-debian-base-install.py @@ -0,0 +1,51 @@ +# Copyright 2011 Lars Wirzenius +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + + +'''Tests for a Debian base install, with openssh-server installed.''' + + +import systest + + +class DebianBasePlusOpenSshServerTests(systest.TestCase): + + def test_only_ssh_port(self): + self.assertEqual(self.find_open_ports(), ['22/tcp']) + + def test_ssh_login(self): + user = self.settings['user'] + out = self.targetcmd(['id']) + self.assertMatches(r'^uid=\d+\(%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', '-S', 'id'], + stdin='%s\n' % self.settings['user-password']) + self.assertMatches(r'^uid=0\(root\)', out) + -- cgit v1.2.1