Skip to content

Commit

Permalink
Update util_test.py
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslynnwu committed Jun 26, 2019
1 parent bf3fd4a commit 1abbc38
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions apitools/gen/util_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,15 @@ class GetURLContentTest(unittest2.TestCase):

def testUnspecifiedContentEncoding(self):
data = 'regular non-gzipped content'
with patch.object(urllib_request, 'urlopen',
with patch.object(urllib_request, 'urlopen',
return_value=MockRequestResponse(data, '')):
self.assertEqual(data, util._GetURLContent('unused_url_parameter'))

def testGZippedContent(self):
data = u'¿Hola qué tal?'
compressed_data = _Gzip(data.encode('utf-8'))
with patch.object(urllib_request, 'urlopen',
return_value=MockRequestResponse(compressed_data, 'gzip')):
return_value=MockRequestResponse(
compressed_data, 'gzip')):
self.assertEqual(data, util._GetURLContent(
'unused_url_parameter').decode('utf-8'))

0 comments on commit 1abbc38

Please sign in to comment.