python-pycurl/pycurl-libssh.patch

63 lines
2.5 KiB
Diff

--- a/tests/ssh_key_cb_test.py
+++ b/tests/ssh_key_cb_test.py
@@ -33,8 +33,11 @@ class SshKeyCbTest(unittest.TestCase):
def keyfunction(known_key, found_key, match):
return pycurl.KHSTAT_FINE
- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ try:
+ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
+ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ except pycurl.error as e:
+ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0])
try:
self.curl.perform()
@@ -47,8 +50,11 @@ class SshKeyCbTest(unittest.TestCase):
def keyfunction(known_key, found_key, match):
return pycurl.KHSTAT_REJECT
- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ try:
+ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
+ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ except pycurl.error as e:
+ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0])
try:
self.curl.perform()
@@ -62,8 +68,11 @@ class SshKeyCbTest(unittest.TestCase):
def keyfunction(known_key, found_key, match):
return 'bogus'
- self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
- self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ try:
+ self.curl.setopt(pycurl.SSH_KNOWNHOSTS, '.known_hosts')
+ self.curl.setopt(pycurl.SSH_KEYFUNCTION, keyfunction)
+ except pycurl.error as e:
+ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0])
try:
self.curl.perform()
@@ -82,9 +91,15 @@ class SshKeyCbUnsetTest(unittest.TestCas
@util.min_libcurl(7, 19, 6)
@util.guard_unknown_libcurl_option
def test_keyfunction_none(self):
- self.curl.setopt(pycurl.SSH_KEYFUNCTION, None)
+ try:
+ self.curl.setopt(pycurl.SSH_KEYFUNCTION, None)
+ except pycurl.error as e:
+ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0])
@util.min_libcurl(7, 19, 6)
@util.guard_unknown_libcurl_option
def test_keyfunction_unset(self):
- self.curl.unsetopt(pycurl.SSH_KEYFUNCTION)
+ try:
+ self.curl.unsetopt(pycurl.SSH_KEYFUNCTION)
+ except pycurl.error as e:
+ self.assertEqual(pycurl.E_UNKNOWN_OPTION, e.args[0])