Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def do_it():
import psiturk.experiment
reload(psiturk.experiment)
psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
psiturk.experiment.app.wsgi_app)
return psiturk.experiment.app
yield do_it
def do_it():
import psiturk.experiment
reload(psiturk.experiment)
psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
psiturk.experiment.app.wsgi_app)
return psiturk.experiment.app
yield do_it
from psiturk.tasks import do_campaign_round
campaign_args = {
'campaign': campaign,
'job_id': campaign.campaign_job_id
}
from psiturk.experiment import app
mocker.patch.object(app.apscheduler,
'remove_job', lambda *args, **kwargs: True)
import psiturk.tasks
mocker.patch.object(psiturk.models.Participant, 'count_completed', lambda *args, **kwargs: campaign.goal)
import psiturk.experiment
remove_job_mock = mocker.patch.object(psiturk.experiment.app.apscheduler, 'remove_job')
do_campaign_round(**campaign_args)
remove_job_mock.assert_called()
def setUp(self, case=None):
'''Build up fixtures'''
import psiturk.experiment
reload(psiturk.experiment)
psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
psiturk.experiment.app.wsgi_app)
self.app = psiturk.experiment.app.test_client()
self.config = psiturk.experiment.CONFIG
# Fake MTurk data
self.worker_id = fake.md5(raw_output=False)
self.hit_id = fake.md5(raw_output=False)
self.assignment_id = fake.md5(raw_output=False)
def setUp(self, case=None):
'''Build up fixtures'''
import psiturk.experiment
reload(psiturk.experiment)
psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
psiturk.experiment.app.wsgi_app)
self.app = psiturk.experiment.app.test_client()
self.config = psiturk.experiment.CONFIG
# Fake MTurk data
self.worker_id = fake.md5(raw_output=False)
self.hit_id = fake.md5(raw_output=False)
self.assignment_id = fake.md5(raw_output=False)
}
from psiturk.experiment import app
mocker.patch.object(app.apscheduler,
'remove_job', lambda *args, **kwargs: True)
from psiturk.amt_services_wrapper import MTurkServicesWrapper
aws_services_wrapper = MTurkServicesWrapper()
aws_services_wrapper.config['Task Parameters']['experiment_code_version'] = '1.1'
import psiturk.tasks
mocker.patch.object(psiturk.tasks.TaskUtils, 'aws_services_wrapper', aws_services_wrapper)
import psiturk.experiment
remove_job_mock = mocker.patch.object(psiturk.experiment.app.apscheduler, 'remove_job')
do_campaign_round(**campaign_args)
remove_job_mock.assert_called()
def setUp(self, case=None):
'''Build up fixtures'''
import psiturk.experiment
reload(psiturk.experiment)
psiturk.experiment.app.wsgi_app = FlaskTestClientProxy(
psiturk.experiment.app.wsgi_app)
self.app = psiturk.experiment.app.test_client()
self.config = psiturk.experiment.CONFIG
# Fake MTurk data
self.worker_id = fake.md5(raw_output=False)
self.hit_id = fake.md5(raw_output=False)
self.assignment_id = fake.md5(raw_output=False)
from __future__ import absolute_import
if __name__ == '__main__':
from . import experiment
experiment.run_webserver()