Update on Tracking Previous Requests

Modified the comment in sessions.py and rewrote the test in
test_requests.py
This commit is contained in:
ContinuousFunction
2014-08-19 10:51:26 -07:00
parent df641e74ff
commit 2fc6e8a894
2 changed files with 5 additions and 4 deletions
+1 -1
View File
@@ -97,7 +97,7 @@ class SessionRedirectMixin(object):
prepared_request = req.copy()
if i > 0:
#create deep copy of the history and keep track of redirects
#update history and keep track of redirects
hist.append(resp)
new_hist = list(hist)
resp.history = new_hist
+4 -3
View File
@@ -976,10 +976,11 @@ class RequestsTestCase(unittest.TestCase):
def test_requests_history_is_saved(self):
r = requests.get('https://httpbin.org/redirect/5')
count = 0
total = r.history[-1].history
i = 0
for item in r.history:
assert len(item.history) == count
count = count + 1
assert item.history == total[0:i]
i=i+1
class TestContentEncodingDetection(unittest.TestCase):