def test_open_recruitment_with_blocklist(self, recruiter):
     recruiter.config.set("mturk_qualification_blocklist", u"foo, bar")
     # Our fake response will always return the same QualificationType ID
     recruiter.mturkservice.get_qualification_type_by_name.return_value = {
         "id": u"fake id"
     }
     recruiter.open_recruitment(n=1)
     recruiter.mturkservice.create_hit.assert_called_once_with(
         question=MTurkQuestions.external(
             ad_url="http://fake-domain/ad?recruiter=mturk"),
         description="fake HIT description",
         duration_hours=1.0,
         experiment_id="TEST_EXPERIMENT_UID",
         lifetime_days=1,
         keywords=[u"kw1", u"kw2", u"kw3"],
         max_assignments=1,
         notification_url="http://fake-domain{}".format(SNS_ROUTE_PATH),
         reward=0.01,
         title="fake experiment title",
         annotation="TEST_EXPERIMENT_UID",
         qualifications=[
             MTurkQualificationRequirements.min_approval(95),
             MTurkQualificationRequirements.restrict_to_countries(["US"]),
             MTurkQualificationRequirements.must_not_have(u"fake id"),
             MTurkQualificationRequirements.must_not_have(u"fake id"),
         ],
     )
Example #2
0
    def test_worker_cannot_see_hit_when_blacklist_in_qualifications(
        self, with_cleanup, worker_id, qtype
    ):
        with_cleanup.assign_qualification(qtype["id"], worker_id, score=1)

        print(
            'MANUAL STEP: Check for qualification: "{}". (May be delay)'.format(
                qtype["name"]
            )
        )
        input("Any key to continue...")

        hit = with_cleanup.create_hit(
            **standard_hit_config(
                title="Dallinger: Blacklist",
                qualifications=[
                    MTurkQualificationRequirements.must_not_have(qtype["id"])
                ],
                lifetime_days=0.25,
            )
        )

        print(
            'MANUAL STEP: Should NOT be able to see "{}"" as available HIT'.format(
                hit["title"]
            )
        )
        input("Any key to continue...")

        pass
Example #3
0
 def test_create_hit_with_qualification(self, with_cleanup, qtype):
     qual = MTurkQualificationRequirements.must_not_have(
         qualification_id=qtype["id"]
     )
     hit = with_cleanup.create_hit(**standard_hit_config(qualifications=[qual]))
     assert hit["status"] == "Assignable"
     assert hit["qualification_type_ids"] == [qtype["id"]]