diff options
author | Oleg Pudeyev <oleg@bsdpower.com> | 2016-01-10 19:08:45 -0500 |
---|---|---|
committer | Oleg Pudeyev <oleg@bsdpower.com> | 2016-01-18 13:48:40 -0500 |
commit | 600d33935c17671dfbd05841c910a730151ffdc5 (patch) | |
tree | 880c1664f76db5a571107a27d66808f3af3fbe57 /tests | |
parent | 5765f81fd90ef3c407ddca43223ecdfde21ed2a7 (diff) | |
download | pycurl-600d33935c17671dfbd05841c910a730151ffdc5.tar.gz |
Add setopt_string method, closes #305
Diffstat (limited to 'tests')
-rw-r--r-- | tests/setopt_string_test.py | 30 |
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) |