Ejemplo n.º 1
0
    def test_get_weekly(self, mock_chart_view):
        mock_chart_view.range_func.return_value = Week.this()

        context = TestContext()
        record = context.new_record()
        context2 = TestContext()
        context2.new_record(work_title=record['title'])

        response = self.client.get('/api/v2/charts/works/weekly?limit=5')
        self.assertEqual(len(response.json()), 1)
        self.assertEqual(response.json()[0]['rank'], 1)
        self.assertEqual(response.json()[0]['factor_percent'], 100.0)
        self.assertEqual(response.json()[0]['object']['id'], record['work_id'])
Ejemplo n.º 2
0
def weekly():
    return Week.last()