OLD | NEW |
(Empty) | |
| 1 import unittest |
| 2 import uuid |
| 3 import datetime |
| 4 |
| 5 from boto.mturk.question import ( |
| 6 Question, QuestionContent, AnswerSpecification, FreeTextAnswer, |
| 7 ) |
| 8 from _init_environment import SetHostMTurkConnection, config_environment |
| 9 |
| 10 class MTurkCommon(unittest.TestCase): |
| 11 def setUp(self): |
| 12 config_environment() |
| 13 self.conn = SetHostMTurkConnection() |
| 14 |
| 15 @staticmethod |
| 16 def get_question(): |
| 17 # create content for a question |
| 18 qn_content = QuestionContent() |
| 19 qn_content.append_field('Title', 'Boto no hit type question cont
ent') |
| 20 qn_content.append_field('Text', 'What is a boto no hit type?') |
| 21 |
| 22 # create the question specification |
| 23 qn = Question(identifier=str(uuid.uuid4()), |
| 24 content=qn_content, |
| 25 answer_spec=AnswerSpecification(FreeTextAnswer())) |
| 26 return qn |
| 27 |
| 28 @staticmethod |
| 29 def get_hit_params(): |
| 30 return dict( |
| 31 lifetime=datetime.timedelta(minutes=65), |
| 32 max_assignments=2, |
| 33 title='Boto create_hit title', |
| 34 description='Boto create_hit description', |
| 35 keywords=['boto', 'test'], |
| 36 reward=0.23, |
| 37 duration=datetime.timedelta(minutes=6), |
| 38 approval_delay=60*60, |
| 39 annotation='An annotation from boto create_hit test', |
| 40 response_groups=['Minimal', |
| 41 'HITDetail', |
| 42 'HITQuestion', |
| 43 'HITAssignmentSummary',], |
| 44 ) |
| 45 |
OLD | NEW |