def session_test(self, session_name): session_conf = self.get_session_conf(session_name) app_sequence = session_conf["app_sequence"] npar = session_conf["num_demo_participants"] call_command('create_session', session_name, str(npar)) for app in app_sequence: app_format = common_internal.app_name_format(app) url = "/ExportCsv/{}/".format(app) response = self.client.get(url) # HEADERS CHECK content_disposition = response["Content-Disposition"] content_type = response["content-type"] self.assertEqual(content_type, "text/csv") self.assertTrue( content_disposition.startswith( 'attachment; filename="{} ('.format(app_format))) buff = StringIO() common_internal.export_data(buff, app) self.assertEqual(response.content, buff.getvalue().encode('utf-8'))
def session_test(self, session_name): session_conf = SESSION_CONFIGS_DICT[session_name] app_sequence = session_conf["app_sequence"] npar = session_conf["num_demo_participants"] call_command('create_session', session_name, str(npar)) for app in app_sequence: app_format = common_internal.app_name_format(app) url = "/ExportCsv/{}/".format(app) response = self.client.get(url) # HEADERS CHECK content_disposition = response["Content-Disposition"] content_type = response["content-type"] self.assertEqual(content_type, "text/csv") self.assertTrue( content_disposition.startswith( 'attachment; filename="{} ('.format(app_format))) buff = StringIO() common_internal.export_data(buff, app) self.assertEqual(response.content, buff.getvalue().encode('utf-8'))
def tearDown(self): if self.preserve_data: logger.info( "Recolecting data for session '{}'".format(self.session_name)) buff = six.StringIO() common_internal.export_data(buff, self.session_name) self._data = buff.getvalue()
def tearDown(self): if self.preserve_data: logger.info("Recolecting data for session '{}'".format( self.session_name)) buff = StringIO() common_internal.export_data(buff, self.session_name) self._data = buff.getvalue()