# 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)