Skip to content
Myr

Added autoauth tests

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Kenneth Reitz · committed by Kenneth Reitz · parent fbe0393 · Browse files · 1 file+11 added−10 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

1 file+11 added−10 removed

  • other:+11 added−10 removed

1 file+11 added−10 removed

modified:test_requests.py+11 added-10 removed
1#!/usr/bin/env python2# -*- coding: utf-8 -*-34import sys4import unittest57if sys.version_info >= (3,0):8 from io import StringIO9else:10 try:11 from cStringIO import StringIO12 except ImportError:13 from StringIO import StringIO146import requests789class RequestsTestSuite(unittest.TestCase):
37 unmodified lines
4748 self.assertEqual(r.status_code, 200)495051 requests.add_autoauth(url, auth)5253 r = requests.get(url)54 self.assertEqual(r.status_code, 200)5556 # reset auto authentication57 requests.AUTOAUTHS = []58596061 def test_POSTBIN_GET_POST_FILES(self):6263 bin = requests.post('http://www.postbin.org/')64 self.assertEqual(bin.status_code, 200)6566 post = requests.post(bin.url, data={'some': 'data'})67 self.assertEqual(post.status_code, 201)6868 post2 = requests.post(bin.url, files={'some': StringIO('data')})69 post2 = requests.post(bin.url, files={'some': open('test_requests.py')})70 self.assertEqual(post2.status_code, 201)717273 def test_nonzero_evaluation(self):
23 unmodified lines