From 447636661670a62106b1cb223ea511367af58f8d Mon Sep 17 00:00:00 2001 From: Bryan Wilson Date: Mon, 21 Jun 2021 13:27:10 -0700 Subject: [PATCH] Don't use get_site_ids in backfill_daily_metrics... populate_figures_metrics will do that. Just pass site=None if none passed and task will run for all Sites --- .../commands/backfill_figures_daily_metrics.py | 2 +- tests/test_commands.py | 10 ++++------ 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/figures/management/commands/backfill_figures_daily_metrics.py b/figures/management/commands/backfill_figures_daily_metrics.py index 01142264..d60204b6 100644 --- a/figures/management/commands/backfill_figures_daily_metrics.py +++ b/figures/management/commands/backfill_figures_daily_metrics.py @@ -57,7 +57,7 @@ def handle(self, *args, **options): print('BEGIN: Backfill Figures daily metrics metrics for: {}'.format(dt)) kwargs = dict( - site_id=self.get_site_ids(options['site'])[0], + site_id=options['site'], date_for=str(dt), force_update=options['overwrite'] ) diff --git a/tests/test_commands.py b/tests/test_commands.py index 3387e319..ad1cc766 100644 --- a/tests/test_commands.py +++ b/tests/test_commands.py @@ -92,12 +92,10 @@ def test_backfill_daily_same_day(self): assert mock_populate.call_count == exp_days def test_backfill_daily_for_site(self): - """Test that proper site id gets passed to task func. Doesn't exercise get_side_ids.""" - with mock.patch('figures.management.base.BaseBackfillCommand.get_site_ids') as mock_get_site_ids: - mock_get_site_ids.return_value = [1,] - with mock.patch(self.PLAIN_PATH) as mock_populate: - call_command('backfill_figures_daily_metrics', no_delay=True) - assert mock_populate.called_with(site_id=1) + """Test that proper site id gets passed to task func.""" + with mock.patch(self.PLAIN_PATH) as mock_populate: + call_command('backfill_figures_daily_metrics', no_delay=True) + assert mock_populate.called_with(site_id=1) class TestPopulateFiguresMetricsCommand(object):