'refresh_queries() launches an execution task for each query returned
from Query.outdated_queries().'

def test_enqueues_outdated_queries(self):

    query1 = self.factory.create_query()
    query2 = self.factory.create_query(query_text='select    42;', data_source=self.factory.create_data_source())
    oq = staticmethod((lambda : [query1, query2]))
    with patch('redash.tasks.queries.enqueue_query') as add_job_mock:
        with patch.object(Query, 'outdated_queries', oq):
            refresh_queries()
            self.assertEqual(add_job_mock.call_count, 2)
            add_job_mock.assert_has_calls([call(query1.query_text, query1.data_source, query1.user_id, scheduled_query=query1, metadata=ANY), call(query2.query_text, query2.data_source, query2.user_id, scheduled_query=query2, metadata=ANY)], any_order=True)
