def test_sales_to_user_in_period(self): res = views._sales_to_user_in_period( self.alan.username, self.some_time - datetime.timedelta(hours=10), self.some_time + datetime.timedelta(days=15), [self.flan.id, self.flanmad.id], {self.flan.name: 0, self.flanmad.name: 0}, ) self.assertEqual(2, res[self.flan.name]) self.assertEqual(1, res[self.flanmad.name])
def test_sales_to_user_no_results_out_of_period(self): res = views._sales_to_user_in_period( self.bob.username, self.some_time + datetime.timedelta(days=14), self.some_time + datetime.timedelta(days=15), [self.flan.id, self.flanmad.id], {self.flan.name: 0, self.flanmad.name: 0}, ) self.assertEqual(0, res[self.flan.name]) self.assertEqual(0, res[self.flanmad.name])
def test_sales_to_user_no_results_out_of_period(self): res = views._sales_to_user_in_period( self.bob.username, timezone.datetime(2017, 2, 1, 0, 0, tzinfo=pytz.UTC), timezone.datetime(2017, 2, 17, 0, 0, tzinfo=pytz.UTC), [self.flan.id, self.flanmad.id], {self.flan.name: 0, self.flanmad.name: 0}, ) self.assertEqual(0, res[self.flan.name]) self.assertEqual(0, res[self.flanmad.name])