Example #1
0
 def test_serializer_handles_paddings(self):
     """serializer handles missing paddings"""
     for i in xrange(100):
         wet = 'Lorem ipsum %s' % ('a' * i)
         dry = serializer.dumps(wet)
         self.assertFalse(dry.endswith('='))
         self.assertEqual(wet, serializer.loads(dry))
Example #2
0
    def test_serializer(self):
        """serializer dehydrates and hydrates values"""
        TEST_CASES = (
            'LoremIpsum', 123, [1, 2, '4d'], {'bawww': 'zong', 23: True}
        )

        for wet in TEST_CASES:
            dry = serializer.dumps(wet)
            self.assertEqual(wet, serializer.loads(dry))
Example #3
0
 def permissions(self):
     try:
         return self.permissions_cache
     except AttributeError:
         if self.pickled_permissions:
             self.permissions_cache = serializer.loads(
                 self.pickled_permissions)
         else:
             self.permissions_cache = {}
     return self.permissions_cache
Example #4
0
 def permissions(self):
     try:
         return self.permissions_cache
     except AttributeError:
         if self.pickled_permissions:
             self.permissions_cache = serializer.loads(
                 self.pickled_permissions)
         else:
             self.permissions_cache = {}
     return self.permissions_cache
Example #5
0
    def test_serializer(self):
        """serializer dehydrates and hydrates values"""
        TEST_CASES = ('LoremIpsum', 123, [1, 2, '4d'], {
            'bawww': 'zong',
            23: True
        })

        for wet in TEST_CASES:
            dry = serializer.dumps(wet)
            self.assertEqual(wet, serializer.loads(dry))
Example #6
0
 def field_extra(self):
     if self.pickled_field_extra:
         return serializer.loads(self.pickled_field_extra)
     else:
         return {}
Example #7
0
 def field_extra(self):
     if self.pickled_field_extra:
         return serializer.loads(self.pickled_field_extra)
     else:
         return {}