コード例 #1
0
    def recruiter(self, active_config, counter, mturkservice, hit_id_store):
        from dallinger.recruiters import MTurkLargeRecruiter

        with mock.patch.multiple("dallinger.recruiters",
                                 os=mock.DEFAULT,
                                 get_base_url=mock.DEFAULT) as mocks:
            mocks["get_base_url"].return_value = "http://fake-domain"
            mocks["os"].getenv.return_value = "fake-host-domain"
            active_config.extend({"mode": u"sandbox"})
            r = MTurkLargeRecruiter(counter=counter, store=hit_id_store)
            r.mturkservice = mturkservice
            return r
コード例 #2
0
 def recruiter(self, active_config):
     from dallinger.mturk import MTurkService
     from dallinger.recruiters import MTurkLargeRecruiter
     with mock.patch.multiple('dallinger.recruiters',
                              os=mock.DEFAULT,
                              get_base_url=mock.DEFAULT) as mocks:
         mocks['get_base_url'].return_value = 'http://fake-domain'
         mocks['os'].getenv.return_value = 'fake-host-domain'
         mockservice = mock.create_autospec(MTurkService)
         active_config.extend({'mode': u'sandbox'})
         r = MTurkLargeRecruiter()
         r.mturkservice = mockservice('fake key', 'fake secret')
         r.mturkservice.check_credentials.return_value = True
         r.mturkservice.create_hit.return_value = {'type_id': 'fake type id'}
         return r
コード例 #3
0
    def recruiter(self, active_config, counter):
        from dallinger.mturk import MTurkService
        from dallinger.recruiters import MTurkLargeRecruiter

        with mock.patch.multiple("dallinger.recruiters",
                                 os=mock.DEFAULT,
                                 get_base_url=mock.DEFAULT) as mocks:
            mocks["get_base_url"].return_value = "http://fake-domain"
            mocks["os"].getenv.return_value = "fake-host-domain"
            mockservice = mock.create_autospec(MTurkService)
            active_config.extend({"mode": u"sandbox"})
            r = MTurkLargeRecruiter(counter=counter)
            r.mturkservice = mockservice("fake key", "fake secret",
                                         "fake_region")
            r.mturkservice.check_credentials.return_value = True
            r.mturkservice.create_hit.return_value = {
                "type_id": "fake type id"
            }
            r.current_hit_id = mock.Mock(return_value="fake HIT id")
            return r