Skip to content
Myr

test improvements

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 ba5eddc · Browse files · 1 file+6 added−6 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+6 added−6 removed

  • other:+6 added−6 removed

1 file+6 added−6 removed

modified:test_requests.py+6 added-6 removed
6 unmodified lines
7import cookielib8import os9import unittest1011import requests12import envoy1314try:15 import omnijson as json16except ImportError:17 import json1818import requests1920from requests.sessions import Session2021# TODO: Detect an open port.22PORT = os.environ.get('HTTPBIN_PORT', '7045')22PORT = os.environ.get('HTTPBIN_PORT', '7077')2324HTTPBIN_URL = 'http://0.0.0.0:%s/' % (PORT)25# HTTPBIN_URL = 'http://127.0.0.1:8000/'26
414 unmodified lines
441442443 def test_session_HTTP_200_OK_GET(self):444445 s = Session()445 s = requests.session()446 r = s.get(httpbin('/get'))447 self.assertEqual(r.status_code, 200)448449450 def test_session_persistent_headers(self):451452 heads = {'User-agent': 'Mozilla/5.0'}453454 s = Session()454 s = requests.session()455 s.headers = heads456457 # Make 2 requests from Session object, should send header both times458 r1 = s.get(httpbin('user-agent'))
12 unmodified lines
471 def test_session_persistent_params(self):472473 params = {'a': 'a_test'}474475 s = Session()475 s = requests.session()476 s.params = params477478 # Make 2 requests from Session object, should send header both times479 r1 = s.get(httpbin('get'))
21 unmodified lines