Example #1
0
def test_decode():
    with pytest.raises(EncryptedIDDecodeError):
        decode("", "")                                      # strucr.error
    with pytest.raises(EncryptedIDDecodeError):
        decode("1", "")                                     # binascii.Error
    with pytest.raises(EncryptedIDDecodeError):
        decode(encode(0, "")[:-1] + 'Z', "")                # crc error
Example #2
0
def test_decode():
    with pytest.raises(EncryptedIDDecodeError):
        decode("")  # strucr.error
    with pytest.raises(EncryptedIDDecodeError):
        decode("1")  # binascii.Error
    with pytest.raises(EncryptedIDDecodeError):
        decode(encode(0)[:-1] + 'Z')  # crc error
Example #3
0
 def ekey(self):
     return encode(self.id, get_model_sub_key(self))
def test_encode():
    assert decode(encode(10)) == 10
Example #5
0
 def ekey(self):
     return encode(self.id)
def test_encode():
    sub_key = uuid.uuid4().hex
    assert decode(encode(10, sub_key), sub_key) == 10
Example #7
0
 def ekey(self):
     return encode(self.id, get_model_sub_key(self))