Example #1
0
 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)
Example #2
0
 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)
Example #3
0
    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
Example #4
0
    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
Example #5
0
    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)
Example #6
0
    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)
Example #7
0
 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)
Example #8
0
 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)