fixed a number of shell-related failures.

This commit is contained in:
percious17 2008-12-02 19:58:25 +00:00
parent b2cca18c36
commit 06b678bfef
2 changed files with 8 additions and 4 deletions

View File

@ -91,8 +91,11 @@ def parse_args(*args,**kwargs):
cmdname = args.pop(0)
if cmdname == 'downgrade':
if not args[-1].startswith('--'):
kwargs['version'] = args[-1]
try:
kwargs['version'] = str(int(args[-1]))
args = args[:-1]
except:
pass
except IndexError:
# No command specified: no error message; just show usage

View File

@ -15,6 +15,7 @@ class Shell(fixture.Shell):
def cmd(cls,*p):
p = map(lambda s: str(s),p)
ret = ' '.join([cls._cmd]+p)
print ret
return ret
def execute(self,shell_cmd,runshell=None):
"""A crude simulation of a shell command, to speed things up"""
@ -264,8 +265,8 @@ class TestShellDatabase(Shell,fixture.DB):
# Downgrade must have a valid version specified
self.assertFailure(self.cmd('downgrade',self.url, repos_path))
self.assertFailure(self.cmd('downgrade',self.url, repos_path, '0', 2))
self.assertFailure(self.cmd('downgrade',self.url, repos_path, '0', -1))
self.assertFailure(self.cmd('downgrade',self.url, repos_path, '-1', 2))
#self.assertFailure(self.cmd('downgrade',self.url, repos_path, '1', 2))
self.assertEquals(self.cmd_db_version(self.url, repos_path),1)
self.assertSuccess(self.cmd('downgrade', self.url, repos_path, 0))