def test_pad_round_string(self): from r2.lib.tracking import _pad_message, KEY_SIZE padded = _pad_message("x" * KEY_SIZE) self.assertEquals(len(padded), KEY_SIZE * 2) self.assertEquals(padded[KEY_SIZE:], BLOCK_O_PADDING)
def test_padding_roundtrip(self): from r2.lib.tracking import _unpad_message, _pad_message tested = _unpad_message(_pad_message(MESSAGE)) self.assertEquals(MESSAGE, tested)
def test_pad_empty_string(self): from r2.lib.tracking import _pad_message padded = _pad_message("") self.assertEquals(padded, BLOCK_O_PADDING)
def test_padding_roundtrip(self): tested = tracking._unpad_message(tracking._pad_message(MESSAGE)) self.assertEquals(MESSAGE, tested)
def test_pad_round_string(self): padded = tracking._pad_message("x" * KEY_SIZE) self.assertEquals(len(padded), KEY_SIZE * 2) self.assertEquals(padded[KEY_SIZE:], BLOCK_O_PADDING)
def test_pad_empty_string(self): padded = tracking._pad_message("") self.assertEquals(padded, BLOCK_O_PADDING)