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
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
def ekey(self): return encode(self.id, get_model_sub_key(self))
def test_encode(): assert decode(encode(10)) == 10
def ekey(self): return encode(self.id)
def test_encode(): sub_key = uuid.uuid4().hex assert decode(encode(10, sub_key), sub_key) == 10
def ekey(self): return encode(self.id, get_model_sub_key(self))