summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorOleg Pudeyev <oleg@bsdpower.com>2016-01-10 19:08:45 -0500
committerOleg Pudeyev <oleg@bsdpower.com>2016-01-18 13:48:40 -0500
commit600d33935c17671dfbd05841c910a730151ffdc5 (patch)
tree880c1664f76db5a571107a27d66808f3af3fbe57 /tests
parent5765f81fd90ef3c407ddca43223ecdfde21ed2a7 (diff)
downloadpycurl-600d33935c17671dfbd05841c910a730151ffdc5.tar.gz
Add setopt_string method, closes #305
Diffstat (limited to 'tests')
-rw-r--r--tests/setopt_string_test.py30
1 files changed, 30 insertions, 0 deletions
diff --git a/tests/setopt_string_test.py b/tests/setopt_string_test.py
new file mode 100644
index 0000000..c219b6b
--- /dev/null
+++ b/tests/setopt_string_test.py
@@ -0,0 +1,30 @@
+#! /usr/bin/env python
+# -*- coding: utf-8 -*-
+# vi:ts=4:et
+
+import pycurl
+import unittest
+import nose.tools
+
+from . import appmanager
+from . import util
+
+setup_module, teardown_module = appmanager.setup(('app', 8380))
+
+class SetoptTest(unittest.TestCase):
+ def setUp(self):
+ self.curl = pycurl.Curl()
+
+ def tearDown(self):
+ self.curl.close()
+
+ def test_setopt_string(self):
+ self.curl.setopt_string(pycurl.URL, 'http://localhost:8380/success')
+ sio = util.BytesIO()
+ self.curl.setopt(pycurl.WRITEFUNCTION, sio.write)
+ self.curl.perform()
+ self.assertEqual('success', sio.getvalue().decode())
+
+ @nose.tools.raises(TypeError)
+ def test_setopt_string_integer(self):
+ self.curl.setopt_string(pycurl.VERBOSE, True)