Ejemplo n.º 1
0
 def test_details_opinions(self):
     models.RatingModel(
         namespace='test:obj_test',
         obj_id='user_4',
         user_id='user_3',
     ).set(vote=1, timestamp=1379402590)
     models.RatingModel(
         namespace='test:obj_test',
         obj_id='user_4',
         user_id='user_5',
     ).set(vote=1, timestamp=1379402591)
     models.RatingModel(
         namespace='test:obj_test',
         obj_id='user_4',
         user_id='user_6',
     ).set(vote=-1, timestamp=1379402592)
     self.assertEqual(
         self.obj.details(vote_min=3,
                          vote_max=4,
                          size=1,
                          sort_key='opinions'),
         [{
             'vote': 4.0,
             'when': 1379402586.0,
             'user_id': 'user_4',
             'context': {
                 'param2': '16',
                 'param1': '4'
             },
             'object_id': 'obj_test',
             'opinions': [(-1, 1), (1, 2)],
         }])
Ejemplo n.º 2
0
 def setUp(self):
     models.rclient.flushdb()
     for y in range(10):
         models.RatingModel(namespace='test',
                            user_id='user_%d' % y,
                            obj_id='obj_test').set(vote=y,
                                                   timestamp=1379402590 - y,
                                                   param1=y,
                                                   param2=y**2)
     self.obj = models.ObjModel('test', 'obj_test')
Ejemplo n.º 3
0
 def setUp(self):
     models.rclient.flushdb()
     self.model = models.RatingModel(namespace='test',
                                     user_id='ademarco',
                                     obj_id='reding')
     self.model.set(5, 1379402591, param1=1, param2='two')
Ejemplo n.º 4
0
 def setUp(self):
     rclient.flushdb()
     self.app = app.app.test_client()
     self.model = models.RatingModel(namespace='test',
                                     user_id='ademarco',
                                     obj_id='reding')