@@ -63,82 +63,6 @@ def authorize(self, http):
6363 self .assertTrue (conn .http is authorized )
6464 self .assertTrue (isinstance (creds ._called_with , httplib2 .Http ))
6565
66- def test___iter___empty (self ):
67- PROJECT = 'project'
68- conn = self ._makeOne (PROJECT )
69- URI = '/' .join ([
70- conn .API_BASE_URL ,
71- 'storage' ,
72- conn .API_VERSION ,
73- 'b?project=%s' % PROJECT ,
74- ])
75- http = conn ._http = Http (
76- {'status' : '200' , 'content-type' : 'application/json' },
77- '{}' ,
78- )
79- blobs = list (conn )
80- self .assertEqual (len (blobs ), 0 )
81- self .assertEqual (http ._called_with ['method' ], 'GET' )
82- self .assertEqual (http ._called_with ['uri' ], URI )
83-
84- def test___iter___non_empty (self ):
85- PROJECT = 'project'
86- BLOB_NAME = 'blob-name'
87- conn = self ._makeOne (PROJECT )
88- URI = '/' .join ([
89- conn .API_BASE_URL ,
90- 'storage' ,
91- conn .API_VERSION ,
92- 'b?project=%s' % PROJECT ,
93- ])
94- http = conn ._http = Http (
95- {'status' : '200' , 'content-type' : 'application/json' },
96- '{"items": [{"name": "%s"}]}' % BLOB_NAME ,
97- )
98- blobs = list (conn )
99- self .assertEqual (len (blobs ), 1 )
100- self .assertEqual (blobs [0 ].name , BLOB_NAME )
101- self .assertEqual (http ._called_with ['method' ], 'GET' )
102- self .assertEqual (http ._called_with ['uri' ], URI )
103-
104- def test___contains___miss (self ):
105- PROJECT = 'project'
106- NONESUCH = 'nonesuch'
107- conn = self ._makeOne (PROJECT )
108- URI = '/' .join ([
109- conn .API_BASE_URL ,
110- 'storage' ,
111- conn .API_VERSION ,
112- 'b' ,
113- 'nonesuch?project=%s' % PROJECT ,
114- ])
115- http = conn ._http = Http (
116- {'status' : '404' , 'content-type' : 'application/json' },
117- '{}' ,
118- )
119- self .assertFalse (NONESUCH in conn )
120- self .assertEqual (http ._called_with ['method' ], 'GET' )
121- self .assertEqual (http ._called_with ['uri' ], URI )
122-
123- def test___contains___hit (self ):
124- PROJECT = 'project'
125- BLOB_NAME = 'blob-name'
126- conn = self ._makeOne (PROJECT )
127- URI = '/' .join ([
128- conn .API_BASE_URL ,
129- 'storage' ,
130- conn .API_VERSION ,
131- 'b' ,
132- '%s?project=%s' % (BLOB_NAME , PROJECT ),
133- ])
134- http = conn ._http = Http (
135- {'status' : '200' , 'content-type' : 'application/json' },
136- '{"name": "%s"}' % BLOB_NAME ,
137- )
138- self .assertTrue (BLOB_NAME in conn )
139- self .assertEqual (http ._called_with ['method' ], 'GET' )
140- self .assertEqual (http ._called_with ['uri' ], URI )
141-
14266 def test_build_api_url_no_extra_query_params (self ):
14367 PROJECT = 'project'
14468 conn = self ._makeOne (PROJECT )
@@ -370,14 +294,14 @@ def test_get_all_buckets_empty(self):
370294 {'status' : '200' , 'content-type' : 'application/json' },
371295 '{}' ,
372296 )
373- blobs = conn .get_all_buckets ()
374- self .assertEqual (len (blobs ), 0 )
297+ buckets = list ( conn .get_all_buckets () )
298+ self .assertEqual (len (buckets ), 0 )
375299 self .assertEqual (http ._called_with ['method' ], 'GET' )
376300 self .assertEqual (http ._called_with ['uri' ], URI )
377301
378302 def test_get_all_buckets_non_empty (self ):
379303 PROJECT = 'project'
380- BLOB_NAME = 'blob -name'
304+ BUCKET_NAME = 'bucket -name'
381305 conn = self ._makeOne (PROJECT )
382306 URI = '/' .join ([
383307 conn .API_BASE_URL ,
@@ -387,11 +311,11 @@ def test_get_all_buckets_non_empty(self):
387311 ])
388312 http = conn ._http = Http (
389313 {'status' : '200' , 'content-type' : 'application/json' },
390- '{"items": [{"name": "%s"}]}' % BLOB_NAME ,
314+ '{"items": [{"name": "%s"}]}' % BUCKET_NAME ,
391315 )
392- blobs = conn .get_all_buckets ()
393- self .assertEqual (len (blobs ), 1 )
394- self .assertEqual (blobs [0 ].name , BLOB_NAME )
316+ buckets = list ( conn .get_all_buckets () )
317+ self .assertEqual (len (buckets ), 1 )
318+ self .assertEqual (buckets [0 ].name , BUCKET_NAME )
395319 self .assertEqual (http ._called_with ['method' ], 'GET' )
396320 self .assertEqual (http ._called_with ['uri' ], URI )
397321
0 commit comments