def test_multiple_queries_are_zip_file(self):

        expected_csv = 'two\r\n2\r\n'

        q = SimpleQueryFactory()
        q2 = SimpleQueryFactory()
        fn = generate_report_action()

        res = fn(None, None, [q,q2])
        z = ZipFile(io.BytesIO(res.content))
        got_csv = z.read(z.namelist()[0])

        self.assertEqual(len(z.namelist()), 2)
        self.assertEqual(z.namelist()[0], '%s.csv' % q.title)
        self.assertEqual(got_csv.lower().decode('utf-8'), expected_csv)

    # if commas are not removed from the filename, then Chrome throws "duplicate headers received from server"
dataset/ETHPy150Open groveco/django-sql-explorer/explorer/tests/test_actions.py/TestSqlQueryActions.test_multiple_queries_are_zip_file/original