def test_fq_long_encrypt(self): with self.settings(SECRET_KEY='F00Basddsasasedqweqwasdeqweqwgkdfkdslfksflqi' 'weuwiqeuqwieuiqweasdswqeqwewqeqweasds' 'dasddasdsaasdasdsaddasA4', THOR_DISABLE_FQ_ENCRYPT=False): encoded = FqCrypto.encode(self.FQ_VAL) self.assertEquals(encoded, self.FQ_ENC_LONG) self.assertEquals(FqCrypto.decode(encoded), self.FQ_VAL)
def test_fq_long_encrypt(self): with self.settings( SECRET_KEY='F00Basddsasasedqweqwasdeqweqwgkdfkdslfksflqi' 'weuwiqeuqwieuiqweasdswqeqwewqeqweasds' 'dasddasdsaasdasdsaddasA4', THOR_DISABLE_FQ_ENCRYPT=False): encoded = FqCrypto.encode(self.FQ_VAL) self.assertEquals(encoded, self.FQ_ENC_LONG) self.assertEquals(FqCrypto.decode(encoded), self.FQ_VAL)
def parse_field_component(cls, component): if component[:3] != "FQ:": component = FqCrypto.decode(component) mat = cls.FQ_REGEX.match(component) if mat: return mat.group(1), mat.group(2), mat.group(3) return None
def parse_field_component(cls, component): if component[:3] != 'FQ:': component = FqCrypto.decode(component) mat = cls.FQ_REGEX.match(component) if mat: return mat.group(1), mat.group(2), mat.group(3) return None
def get_fq(self): fq = [ force_text(self.field_query[0]._meta.app_label), force_text(self.field_query[0]._meta.object_name), self.field_query[1], ] fq_val = 'FQ:%s' % '.'.join(fq) if fq_encrypt_disabled(): return fq_val else: return FqCrypto.encode(fq_val)
def test_fq_encrypt_disable(self): with self.settings(SECRET_KEY='F00BA4', THOR_DISABLE_FQ_ENCRYPT=True): encoded = FqCrypto.encode(self.FQ_VAL) self.assertEquals(encoded, self.FQ_VAL) self.assertEquals(FqCrypto.decode(encoded), self.FQ_VAL)