Skip to content
Myr

New tests for new HTTP STATUS Handling

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 4f1301f · Browse files · 1 file+17 added−1 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+17 added−1 removed

  • other:+17 added−1 removed

1 file+17 added−1 removed

modified:test_requests.py+17 added-1 removed
1#!/usr/bin/env python2# -*- coding: utf-8 -*-344import unittest5from cStringIO import StringIO67import requests
45 unmodified lines
5354 post2 = requests.post(bin.url, files={'some': StringIO('data')})55 self.assertEqual(post2.status_code, 201)5657 def test_nonzero_evaluation(self):58 r = requests.get('http://google.com/some-404-url')59 self.assertEqual(bool(r), False)60 61 r = requests.get('http://google.com/')62 self.assertEqual(bool(r), True)6364 def test_request_ok_set(self):65 r = requests.get('http://google.com/some-404-url')66 self.assertEqual(r.ok, False)6768 def test_status_raising(self):69 r = requests.get('http://google.com/some-404-url')70 self.assertRaises(requests.HTTPError, r.raise_for_status)7172 r = requests.get('http://google.com/')73 self.assertFalse(r.error)74 r.raise_for_status()7576if __name__ == '__main__':77 unittest.main()