@@ -38,18 +38,17 @@ def test_load_by_version_v0(self):
38
38
resp = self .serializer .loads (req , data )
39
39
assert resp is None
40
40
41
- def test_read_version_v1 (self ):
41
+ def test_load_by_version_v1 (self ):
42
+ data = b"cc=1,somedata"
42
43
req = Mock ()
43
- resp = self .serializer ._loads_v1 (req , pickle .dumps (self .response_data ))
44
- # We have to decode our urllib3 data back into a unicode string.
45
- assert resp .data == "Hello World" .encode ("utf-8" )
44
+ resp = self .serializer .loads (req , data )
45
+ assert resp is None
46
46
47
- def test_read_version_v2 (self ):
47
+ def test_load_by_version_v2 (self ):
48
+ data = b"cc=2,somedata"
48
49
req = Mock ()
49
- compressed_base64_json = b"x\x9c %O\xb9 \n \x83 @\x10 \xfd \x97 \xa9 -\x92 %E\x14 R\xe4 +\x16 \t \xe6 \x10 \xbb \xb0 \xc7 \xe0 \x81 \xb8 \xb2 \xbb *A\xfc \xf7 \x8c \xa6 |\xe7 \xbc \x99 \xc0 \xa2 \xeb L\xeb \x10 \xa2 \t \xa4 \xd1 _\x88 \xe0 \xc9 3'\xf9 \xbe \xc8 X\xf8 \x95 <=@\x00 \x1a \x95 \xd1 \xf8 Q\xa6 \xf5 \xd8 z\x88 \xbc \xed 1\x80 \x12 \x85 F\xeb \x96 h\xca \xc2 ^\xf3 \xac \xd7 \xe7 \xed \x1b \xf3 SC5\x04 w\xfa \x1c \x8e \x92 _;Y\x1c \x96 \x9a \x94 ]k\xc1 \xdf ~u\xc7 \xc9 \x8f DG\xa0 \xe2 \xac \x92 \xbc \xa9 \xc9 \xf1 \xc8 \xcb Q\xe4 I\xa3 \xc6 U\xb9 _\x14 \xbb \xbd h\xc2 \x1c \xd0 R\xe1 LK$\xd9 \x9c \x17 \xbe \xa7 \xc3 l\xb3 Y\x80 \xad \x94 \xff \x0b \x03 \xed \xa9 V\x17 [2\x83 \xb0 \xf4 \xd1 4\xcf ?E\x03 Im"
50
- resp = self .serializer ._loads_v2 (req , compressed_base64_json )
51
- # We have to decode our urllib3 data back into a unicode string.
52
- assert resp .data == "Hello World" .encode ("utf-8" )
50
+ resp = self .serializer .loads (req , data )
51
+ assert resp is None
53
52
54
53
def test_load_by_version_v3 (self ):
55
54
data = b"cc=3,somedata"
@@ -63,31 +62,6 @@ def test_read_version_v4(self):
63
62
# We have to decode our urllib3 data back into a unicode string.
64
63
assert resp .data == "Hello World" .encode ("utf-8" )
65
64
66
- def test_read_v1_serialized_with_py2_TypeError (self ):
67
- # This tests how the code handles in reading data that was pickled
68
- # with an old version of cachecontrol running under Python 2
69
- req = Mock ()
70
- py2_pickled_data = b"" .join (
71
- [
72
- b"(dp1\n S'response'\n p2\n (dp3\n S'body'\n p4\n S'Hello World'\n " ,
73
- b"p5\n sS'version'\n p6\n S'2'\n sS'status'\n p7\n I200\n " ,
74
- b"sS'reason'\n p8\n S''\n sS'decode_content'\n p9\n I01\n " ,
75
- b"sS'strict'\n p10\n S''\n sS'headers'\n p11\n (dp12\n " ,
76
- b"S'Content-Type'\n p13\n S'text/plain'\n p14\n " ,
77
- b"sS'Cache-Control'\n p15\n S'public'\n p16\n " ,
78
- b"sS'Expires'\n p17\n S'87654'\n p18\n sss." ,
79
- ]
80
- )
81
- resp = self .serializer ._loads_v1 (req , py2_pickled_data )
82
- # We have to decode our urllib3 data back into a unicode
83
- # string.
84
- assert resp .data == "Hello World" .encode ("utf-8" )
85
-
86
- def test_read_v2_corrupted_cache (self ):
87
- # This should prevent a regression of bug #134
88
- req = Mock ()
89
- assert self .serializer ._loads_v2 (req , b"" ) is None
90
-
91
65
def test_read_latest_version_streamable (self , url ):
92
66
original_resp = requests .get (url , stream = True )
93
67
req = original_resp .request
0 commit comments