def test_urlsafe_b64encode_int_very_large_number(self): b64 = ( b'QAAAAAAgAAAAAQAACAAAAAAAAAAAAAAkAAIAAAAAAAAAAAAAAACAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAIAAAAAAAAAAAAAAAAAAAAiAAAAAAAIAAAAAAAAAAAAAAEAACAAAAAAAA=' ) expected = b64 num = 2678771517966886466622496485850735537232223496190189203248435106535830319026141316924949516664780383591425235756710588949364368366679435700855700642969357960349427980681242720502045830438444033569999428606714388704082526548154984676817460705606960919023941301616034362869262429593297635158449513824256 result = urlsafe_b64encode_int(num) assert expected == result
def test_urlsafe_b64encode_int_adds_no_padding_for_number_that_are_multiple_of_6_bits( self): assert b'____________' == urlsafe_b64encode_int(0xFFFFFFFFFFFFFFFFFF) assert 8 == len(urlsafe_b64encode_int(0xFFFFFFFFFFFF))
def test_urlsafe_b64encode_int_limit_8bits_256(self): assert b'AQA=' == urlsafe_b64encode_int(256)
def test_urlsafe_b64encode_int_limit_8bits_255(self): assert b'_w==' == urlsafe_b64encode_int(255)
def test_urlsafe_b64encode_int_basic(self): assert b'HKq1w7M=' == urlsafe_b64encode_int(123123123123)
def test_urlsafe_b64encode_int_zero(self): assert b'AA==' == urlsafe_b64encode_int(0)