mirror of
https://github.com/kennethreitz/requests.git
synced 2026-06-05 22:50:18 +00:00
added simple test fixture for Postbin and posting
both files and data
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
|
||||
import unittest
|
||||
from cStringIO import StringIO
|
||||
|
||||
import requests
|
||||
|
||||
@@ -42,6 +44,18 @@ class RequestsTestSuite(unittest.TestCase):
|
||||
|
||||
self.assertEqual(r.status_code, 200)
|
||||
|
||||
def test_POSTBIN_GET_POST_FILES(self):
|
||||
|
||||
bin = requests.post('http://www.postbin.org/')
|
||||
self.assertEqual(bin.status_code, 200)
|
||||
|
||||
post = requests.post(bin.url, data={'some': 'data'})
|
||||
self.assertEqual(post.status_code, 201)
|
||||
|
||||
post2 = requests.post(bin.url, files={'some': StringIO('data')})
|
||||
self.assertEqual(post2.status_code, 201)
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user