2003-09-06 20:29:35 +02:00
|
|
|
###
|
2004-08-23 15:14:06 +02:00
|
|
|
# Copyright (c) 2002-2004, Jeremiah Fincher
|
2003-09-06 20:29:35 +02:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions are met:
|
|
|
|
#
|
|
|
|
# * Redistributions of source code must retain the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer.
|
|
|
|
# * Redistributions in binary form must reproduce the above copyright notice,
|
|
|
|
# this list of conditions, and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
# * Neither the name of the author of this software nor the name of
|
|
|
|
# contributors to this software may be used to endorse or promote products
|
|
|
|
# derived from this software without specific prior written consent.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
###
|
|
|
|
|
2003-10-21 03:55:13 +02:00
|
|
|
import os
|
|
|
|
import time
|
|
|
|
|
2003-12-02 13:27:45 +01:00
|
|
|
from testsupport import *
|
2003-09-06 20:29:35 +02:00
|
|
|
|
2004-10-26 00:59:03 +02:00
|
|
|
class DebianTestCase(PluginTestCase):
|
2004-10-23 00:08:03 +02:00
|
|
|
plugins = ('Debian',)
|
|
|
|
timeout = 100
|
|
|
|
cleanDataDir = False
|
|
|
|
fileDownloaded = False
|
2003-10-21 03:55:13 +02:00
|
|
|
|
2004-10-23 00:08:03 +02:00
|
|
|
if network:
|
2004-10-26 00:59:03 +02:00
|
|
|
def setUp(self, nick='test'):
|
|
|
|
PluginTestCase.setUp(self)
|
2004-01-01 20:51:48 +01:00
|
|
|
try:
|
2004-10-23 00:08:03 +02:00
|
|
|
datadir = conf.supybot.directories.data()
|
|
|
|
if os.path.exists(os.path.join(datadir,
|
2004-10-26 00:59:03 +02:00
|
|
|
'Contents-i386.gz')):
|
2004-01-01 20:51:48 +01:00
|
|
|
pass
|
|
|
|
else:
|
|
|
|
print
|
2004-12-10 08:10:06 +01:00
|
|
|
print "Downloading files, this may take awhile."
|
2004-10-26 00:59:03 +02:00
|
|
|
filename = os.path.join(datadir, 'Contents-i386.gz')
|
2004-01-01 20:51:48 +01:00
|
|
|
while not os.path.exists(filename):
|
|
|
|
time.sleep(1)
|
2004-12-10 08:10:06 +01:00
|
|
|
print "Download complete."
|
2004-10-26 00:59:03 +02:00
|
|
|
print "Starting test ..."
|
|
|
|
self.fileDownloaded = True
|
2004-01-01 20:51:48 +01:00
|
|
|
except KeyboardInterrupt:
|
2003-10-21 03:55:13 +02:00
|
|
|
pass
|
|
|
|
|
2005-01-04 04:28:33 +01:00
|
|
|
def testDebBugNoHtml(self):
|
|
|
|
self.assertNotRegexp('debian bug 287792', r'\<em\>')
|
|
|
|
|
2004-01-01 20:51:48 +01:00
|
|
|
def testDebversion(self):
|
|
|
|
self.assertHelp('debian version')
|
|
|
|
self.assertRegexp('debian version lakjdfad',
|
|
|
|
r'^No package.*\(all\)')
|
|
|
|
self.assertRegexp('debian version unstable alkdjfad',
|
|
|
|
r'^No package.*\(unstable\)')
|
|
|
|
self.assertRegexp('debian version gaim',
|
2004-01-21 05:17:18 +01:00
|
|
|
r'\d+ matches found:.*gaim.*\(stable')
|
2004-02-12 00:39:47 +01:00
|
|
|
self.assertRegexp('debian version linux-wlan',
|
|
|
|
r'\d+ matches found:.*linux-wlan.*')
|
2004-04-28 09:54:04 +02:00
|
|
|
self.assertRegexp('debian version --exact linux-wlan',
|
|
|
|
r'^No package.*\(all\)')
|
2004-01-01 20:51:48 +01:00
|
|
|
self.assertError('debian version unstable')
|
2003-10-21 03:55:13 +02:00
|
|
|
|
2004-01-01 20:51:48 +01:00
|
|
|
def testDebfile(self):
|
|
|
|
self.assertHelp('file')
|
|
|
|
if not self.fileDownloaded:
|
|
|
|
pass
|
|
|
|
self.assertRegexp('file --exact bin/gaim', r'net/gaim')
|
2003-09-06 20:29:35 +02:00
|
|
|
|
2004-01-01 20:51:48 +01:00
|
|
|
def testDebincoming(self):
|
2004-10-23 00:08:03 +02:00
|
|
|
self.assertNotError('incoming')
|
2003-09-06 20:29:35 +02:00
|
|
|
|
2004-12-08 04:19:07 +01:00
|
|
|
def testDebianize(self):
|
|
|
|
self.assertNotError('debianize supybot')
|
|
|
|
|
2003-09-06 20:29:35 +02:00
|
|
|
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
|
|
|
|