Skip to content
Myr

whatever

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 2109afc · Browse files · 1 file+9 added−21 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+9 added−21 removed

  • other:+9 added−21 removed

1 file+9 added−21 removed

modified:test_requests.py+9 added-21 removed
1#!/usr/bin/env python2# -*- coding: utf-8 -*-3456from __future__ import with_statement78import StringIO9import time10import os11import sys12import unittest1314import requests15import envoy
4 unmodified lines
20 import omnijson as json21except ImportError:22 import json2324if (sys.platform == 'win32') and ('HTTPBIN_URL' not in os.environ):25 os.environ['HTTPBIN_URL'] = 'http://httpbin.org/'2627# TODO: Detect an open port.28PORT = os.environ.get('HTTPBIN_PORT', '7077')29HTTPBIN_URL = os.environ.get('HTTPBIN_URL', 'http://0.0.0.0:%s/' % (PORT))3025HTTPBIN_URL = 'http://0.0.0.0:%s/' % (PORT)26# HTTPBIN_URL = 'http://127.0.0.1:8000/'312832def httpbin(*suffix):33 """Returns url for HTTPBIN resource."""3435 return HTTPBIN_URL + '/'.join(suffix)
12 unmodified lines
48 def setUp(self):4950 global _httpbin5149 if not _httpbin:5051 c = envoy.connect('gunicorn httpbin:app --bind=0.0.0.0:%s' % (PORT))5253 self.httpbin = c54 _httpbin = True52 if (not 'HTTPBIN_URL' in os.environ) and not _httpbin:53 c = envoy.connect('httpbin %s' % (PORT))54 time.sleep(1)55 _httpbin = True56575859 def tearDown(self):60 """Teardown."""61 # self.httpbin.kill()62 pass636458 def test_entry_points(self):5960 requests.session61 requests.session().get
72 unmodified lines
134 r = requests.put(httpbin('put'))135 self.assertEqual(r.status_code, 200)136137145 def test_HTTP_200_OK_PATCH(self):146 r = requests.patch(httpbin('patch'))147 self.assertEqual(r.status_code, 200)148149138 def test_BASICAUTH_TUPLE_HTTP_200_OK_GET(self):139140 for service in SERVICES:141
574 unmodified lines