Skip to content

Commit 687fdbd

Browse files
pferateJon Wayne Parrott
authored and
Jon Wayne Parrott
committed
Update helper b64 encode/decode tests (googleapis#631)
1 parent 499375c commit 687fdbd

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

tests/test__helpers.py

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,11 @@ class Test__urlsafe_b64encode(unittest.TestCase):
205205

206206
DEADBEEF_ENCODED = b'ZGVhZGJlZWY'
207207

208+
def test_valid_input_str(self):
209+
test_string = 'deadbeef'
210+
result = _helpers._urlsafe_b64encode(test_string)
211+
self.assertEqual(result, self.DEADBEEF_ENCODED)
212+
208213
def test_valid_input_bytes(self):
209214
test_string = b'deadbeef'
210215
result = _helpers._urlsafe_b64encode(test_string)
@@ -218,15 +223,22 @@ def test_valid_input_unicode(self):
218223

219224
class Test__urlsafe_b64decode(unittest.TestCase):
220225

226+
DEADBEEF_DECODED = b'deadbeef'
227+
228+
def test_valid_input_str(self):
229+
test_string = 'ZGVhZGJlZWY'
230+
result = _helpers._urlsafe_b64decode(test_string)
231+
self.assertEqual(result, self.DEADBEEF_DECODED)
232+
221233
def test_valid_input_bytes(self):
222234
test_string = b'ZGVhZGJlZWY'
223235
result = _helpers._urlsafe_b64decode(test_string)
224-
self.assertEqual(result, b'deadbeef')
236+
self.assertEqual(result, self.DEADBEEF_DECODED)
225237

226238
def test_valid_input_unicode(self):
227-
test_string = b'ZGVhZGJlZWY'
239+
test_string = u'ZGVhZGJlZWY'
228240
result = _helpers._urlsafe_b64decode(test_string)
229-
self.assertEqual(result, b'deadbeef')
241+
self.assertEqual(result, self.DEADBEEF_DECODED)
230242

231243
def test_bad_input(self):
232244
import binascii

0 commit comments

Comments
 (0)