Ejemplo n.º 1
0
    def setUp(self):
        super(TestCollections, self).setUp()
        self.today = datetime.date.today()
        self.collection = Collection.objects.get(pk=512)
        self.url = reverse('stats.collection',
                           args=[self.collection.uuid, 'json'])

        for x in xrange(1, 4):
            data = {
                'date':
                self.today - datetime.timedelta(days=x - 1),
                'id':
                int(self.collection.pk),
                'count':
                x,
                'data':
                search.es_dict({
                    'subscribers': x,
                    'votes_up': x,
                    'votes_down': x,
                    'downloads': x
                })
            }
            CollectionCount.index(data, id='%s-%s' % (x, self.collection.pk))

        self.refresh('stats')
Ejemplo n.º 2
0
    def setUp(self):
        super(TestCollections, self).setUp()
        self.today = datetime.date.today()
        self.collection = Collection.objects.get(pk=512)
        self.url = reverse('stats.collection',
                           args=[self.collection.uuid, 'json'])

        for x in xrange(1, 4):
            data = {'date': self.today - datetime.timedelta(days=x - 1),
                    'id': int(self.collection.pk), 'count': x,
                    'data': search.es_dict({'subscribers': x, 'votes_up': x,
                                            'votes_down': x, 'downloads': x})}
            CollectionCount.index(data, id='%s-%s' % (x, self.collection.pk))

        self.refresh('stats')