[Checkins]
SVN: zc.buildoutsftp/branches/dev/src/zc/buildoutsftp/tests.py
removed decoy non-working tests
Jim Fulton
jim at zope.com
Wed Mar 7 11:22:42 EST 2007
Log message for revision 73033:
removed decoy non-working tests
Changed:
D zc.buildoutsftp/branches/dev/src/zc/buildoutsftp/tests.py
-=-
Deleted: zc.buildoutsftp/branches/dev/src/zc/buildoutsftp/tests.py
===================================================================
--- zc.buildoutsftp/branches/dev/src/zc/buildoutsftp/tests.py 2007-03-07 15:45:34 UTC (rev 73032)
+++ zc.buildoutsftp/branches/dev/src/zc/buildoutsftp/tests.py 2007-03-07 16:22:41 UTC (rev 73033)
@@ -1,91 +0,0 @@
-##############################################################################
-#
-# Copyright (c) 2006 Zope Corporation and Contributors.
-# All Rights Reserved.
-#
-# This software is subject to the provisions of the Zope Public License,
-# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
-# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
-# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
-# FOR A PARTICULAR PURPOSE.
-#
-##############################################################################
-
-import os, sys
-
-import paramiko
-
-from zope.testing import doctest
-
-class Replace:
-
- def __init__(self, module, **attrs):
- self.module = module
- self.original = original = {}
-
- for name, value in attrs.iteritems():
- original[name] = getattr(module, name)
- setattr(module, name, value)
-
- def restore(self):
- for name, value in self.attrs.iteritems():
- setattt(self.module, name, value)
-
-hkeys = [
- ('foo.com', 'comkey'),
- ('foo.org', 'orgkey'),
- ('foo.net', 'netkey'),
- ('foo.biz', 'bizkey'),
- ]
-
-def setup(test):
- # We're going to replace much of paramiko, and, if necessary, _winreg
- # to try to control urllib2sftp's environment.
-
- teardown = []
- test.globs['__teardown'] = teardown
-
- test.globs['__HOME'] = os.environ.get('HOME')
- os.environ['HOME'] == '/testhome'
-
- if sys.platform == 'win32':
- import _winreg
-
- key = object()
-
- def OpenKey(*args):
- if args != (_winreg.HKEY_CURENT_USER,
- r'Software\SimonTatham\PuTTY\SshHoskKeys'):
- raise ValueError("Bad keys", *args)
- return key
-
- def EnumValue(k, index):
- if k is not key:
- raise ValueError('Bad key')
- try:
- host, hkey = hkeys[index]
- except IndexError:
- raise WindowsError(index)
-
- return 'rsa at 22:'+host, hkey, 0
-
- HostKeys = paramiko.HostKeys
-
- teardown.append(Replace(_winreg,
- OpenKey=OpenKey,
- EnumValue=EnumValue,
- ).restore
- )
- else:
- def HostKeys(path=None):
- if path != '/testhome/.ssh/known_hosts':
- raise IOError('No suh file', path)
- return dict([
- (host, {'ssh-rsa': paramiko.PKey(hkey)})
- for (host, hkey) in hkeys
- ])
-
-
-def test_suite():
- return doctest.DocTestSuite()
More information about the Checkins
mailing list