def test_b64_encode_with_unicode_encoded_as_unicode(self): """Some servers will respond with unicode encoded strings. The test below uses unicode open and close quotes around the max age setting, which raises an exception if we treat it as a string. This test ensures we recognize the unicode encoded string act accordingly. """ unicode_result = _b64_encode(self.unicode_string.encode('utf-8')) assert _b64_decode_str(unicode_result) == self.unicode_string bytes_result = _b64_encode(self.unicode_string) assert _b64_decode_str(bytes_result) == self.unicode_string
def test_b64_encode_with_str(self, encode_str): _b64_encode(self.unicode_string) assert encode_str.called
def test_b64_encode_with_bytes(self, encode_bytes): _b64_encode(self.unicode_string.encode('utf-8')) assert encode_bytes.called