typingpool 0.8.11 → 0.8.13

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/bin/tp-assign +5 -4
  3. data/bin/tp-collect +16 -6
  4. data/bin/tp-finish +5 -4
  5. data/bin/tp-make +5 -4
  6. data/bin/tp-review +52 -26
  7. data/lib/typingpool/test.rb +4 -126
  8. data/lib/typingpool/test/fixtures/tp_collect_id.txt +1 -1
  9. data/lib/typingpool/test/fixtures/tp_collect_sandbox-assignment.csv +7 -8
  10. data/lib/typingpool/test/fixtures/tp_review2a_id.txt +1 -0
  11. data/lib/typingpool/test/fixtures/tp_review2a_sandbox-assignment.csv +7 -0
  12. data/lib/typingpool/test/fixtures/tp_review2b_id.txt +1 -0
  13. data/lib/typingpool/test/fixtures/tp_review2b_sandbox-assignment.csv +7 -0
  14. data/lib/typingpool/test/fixtures/tp_review3_id.txt +1 -0
  15. data/lib/typingpool/test/fixtures/tp_review3_sandbox-assignment.csv +7 -0
  16. data/lib/typingpool/test/fixtures/tp_review_id.txt +1 -1
  17. data/lib/typingpool/test/fixtures/tp_review_sandbox-assignment.csv +7 -8
  18. data/lib/typingpool/test/fixtures/vcr/tp-collect-1.yml +3176 -1814
  19. data/lib/typingpool/test/fixtures/vcr/tp-collect-2.yml +116 -2641
  20. data/lib/typingpool/test/fixtures/vcr/tp-collect-3.yml +119 -2693
  21. data/lib/typingpool/test/fixtures/vcr/tp-review-1.yml +353 -355
  22. data/lib/typingpool/test/fixtures/vcr/tp-review-2.yml +161 -242
  23. data/lib/typingpool/test/fixtures/vcr/tp-review-3.yml +4716 -0
  24. data/lib/typingpool/test/fixtures/vcr/tp-review-4.yml +741 -0
  25. data/lib/typingpool/test/fixtures/vcr/tp-review-5.yml +248 -0
  26. data/lib/typingpool/test/fixtures/vcr/tp-review-6.yml +233 -0
  27. data/lib/typingpool/test/fixtures/vcr/tp-review-7.yml +4479 -0
  28. data/lib/typingpool/test/fixtures/vcr/tp-review-8.yml +188 -0
  29. data/lib/typingpool/test/fixtures/vcr/tp-review-9.yml +187 -0
  30. data/lib/typingpool/test/script.rb +13 -320
  31. data/lib/typingpool/utility/test.rb +175 -0
  32. data/lib/typingpool/utility/test/script.rb +342 -0
  33. data/lib/typingpool/version.rb +1 -1
  34. data/test/make_amazon_question_fixture.rb +1 -1
  35. data/test/make_tp_collect_fixture_1.rb +18 -19
  36. data/test/make_tp_collect_fixture_2.rb +16 -10
  37. data/test/make_tp_collect_fixture_3.rb +15 -9
  38. data/test/make_tp_collect_fixture_4.rb +19 -11
  39. data/test/make_tp_collect_fixture_5.rb +25 -0
  40. data/test/make_tp_collect_fixture_6.rb +22 -0
  41. data/test/make_tp_collect_fixture_7.rb +22 -0
  42. data/test/make_tp_collect_fixture_8.rb +26 -0
  43. data/test/make_tp_review_fixture_1.rb +18 -19
  44. data/test/make_tp_review_fixture_2.rb +43 -24
  45. data/test/make_tp_review_fixture_3.rb +35 -0
  46. data/test/make_tp_review_fixture_4.rb +56 -0
  47. data/test/test_integration_script_1_tp_config.rb +7 -7
  48. data/test/test_integration_script_2_tp_make.rb +12 -12
  49. data/test/test_integration_script_3_tp_assign.rb +23 -21
  50. data/test/test_integration_script_4_tp_review.rb +156 -23
  51. data/test/test_integration_script_5_tp_collect.rb +33 -24
  52. data/test/test_integration_script_6_tp_finish.rb +23 -20
  53. data/test/test_unit_amazon.rb +4 -2
  54. data/test/test_unit_filer.rb +6 -6
  55. data/test/test_unit_project.rb +2 -2
  56. data/test/test_unit_project_local.rb +2 -2
  57. data/test/test_unit_project_remote.rb +3 -1
  58. data/test/test_unit_template.rb +6 -6
  59. data/test/test_unit_test.rb +3 -3
  60. metadata +23 -3
  61. data/lib/typingpool/app/test.rb +0 -69
@@ -0,0 +1,188 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
6
+ body:
7
+ encoding: UTF-8
8
+ string: PageSize=100&PageNumber=1&Operation=GetReviewableHITs&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T02%3A56%3A54Z&Version=2012-03-25&Signature=yAz13VNueH3lJq2opNjnpDxGCJw%3D
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
16
+ Content-Length:
17
+ - '219'
18
+ Host:
19
+ - mechanicalturk.sandbox.amazonaws.com
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - text/xml
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Date:
30
+ - Sat, 08 Apr 2017 02:56:55 GMT
31
+ Server:
32
+ - MTurk
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ <?xml version="1.0"?>
37
+ <GetReviewableHITsResponse><OperationRequest><RequestId>de63f073-da44-4251-8164-ab97c09f1417</RequestId></OperationRequest><GetReviewableHITsResult><Request><IsValid>True</IsValid></Request><NumResults>79</NumResults><TotalNumResults>79</TotalNumResults><PageNumber>1</PageNumber><HIT><HITId>3WA2XVDZEMX9ABEMKZBQSN1KQKME6H</HITId></HIT><HIT><HITId>3WYZV0QBFJTOMNMYBVIQRS8JKR8BX8</HITId></HIT><HIT><HITId>3QE4DGPGBRRTF26Z768ZVS2I79VG4F</HITId></HIT><HIT><HITId>36GJS3V78V6JIKPKADV31UR1P6LGJ6</HITId></HIT><HIT><HITId>3EKZL9T8Y82AA2EPKRWZZQQ7EMPCHN</HITId></HIT><HIT><HITId>3IKDQS3DQEGA6XP9Q9EKZ2RMEZ4CIG</HITId></HIT><HIT><HITId>3KL228NDMV2ET4V2SYVF29RE4VLGK5</HITId></HIT><HIT><HITId>3FBEFUUYRKL6KYXA4U94W4BT55P6AF</HITId></HIT><HIT><HITId>3FI30CQHVKZB3822A890RFVZNNA6BA</HITId></HIT><HIT><HITId>3RWB1RTQDJ30BGM0MSOZ6DWFAMF8PJ</HITId></HIT><HIT><HITId>386659BNTLXFCZYV6M0UC28ZO8X10L</HITId></HIT><HIT><HITId>3D42WVSDH8B3Z9OOLTQOTW6D1VUYFJ</HITId></HIT><HIT><HITId>3PEG1BH7AE7I2NNRCC311Y0HOIUBKK</HITId></HIT><HIT><HITId>37SQU136V74FJOJD254UQ7R9T0311O</HITId></HIT><HIT><HITId>37SOB9Z0SSDOJY1WIJ0WYFFKPQM3LO</HITId></HIT><HIT><HITId>3UXQ63NLAA2TMT59XCF2GYDWDIZBLN</HITId></HIT><HIT><HITId>3Q2T3FD0ONO8PGJHIV1BYSU9PVC3MQ</HITId></HIT><HIT><HITId>3D7VY91L65DDSBNUXOGHGBSLDNPBMP</HITId></HIT><HIT><HITId>3TZDZ3Y0JSMX8TM86IJN5D9SRCR19X</HITId></HIT><HIT><HITId>36AZSFEYZ4GWIYH3BGH837BY4G1BV6</HITId></HIT><HIT><HITId>33NOQL7T9OFUPKO691M1XBYTKLM8Z4</HITId></HIT><HIT><HITId>3HFWPF5AK9ZBNBWM2SXXA1TFHKU3S2</HITId></HIT><HIT><HITId>30ZKOOGW2WMBDCWDYOXN18KCXU91AC</HITId></HIT><HIT><HITId>306996CF6W0GWM1542XJWJ4IFCU1B7</HITId></HIT><HIT><HITId>3UDTAB6HH6FX141QAZFNR8QIMKL902</HITId></HIT><HIT><HITId>3APP19WN71U7UPADQU1ESQMW3026GR</HITId></HIT><HIT><HITId>3HY86PZXPYYE3PDPETZ9XRA3I971E7</HITId></HIT><HIT><HITId>37VUR2VJ6A5Z6RTBI2TE73A0XXUC1P</HITId></HIT><HIT><HITId>3Z8UJEJOCZTTIW0NTMX6T6OPPW593X</HITId></HIT><HIT><HITId>3BCRDCM0ODACWB6WGLMTQIEPAHJ6KU</HITId></HIT><HIT><HITId>3PKVGQTFIH002ZTXCOQIALKW4J5YRE</HITId></HIT><HIT><HITId>3O0M2G5VC6IE0SJRT02P3BGV3W194I</HITId></HIT><HIT><HITId>3GS542CVJV3WWBNR75LZ83M93SW95N</HITId></HIT><HIT><HITId>3PGQRAZX020C3ETARDQN0VPSQLOYS2</HITId></HIT><HIT><HITId>3TFJJUELSH56VCB716TSCMK5P38C26</HITId></HIT><HIT><HITId>38B7Q9C28GLSFFN5COV40909ZN7963</HITId></HIT><HIT><HITId>3ZURAPD2883693DL94JFF9V3UAM1FP</HITId></HIT><HIT><HITId>3RDTX9JRTYHBJF1AVY0W6N05UYR972</HITId></HIT><HIT><HITId>3PZDSVZ3J5XZPUNLUALULCBF8LIN4V</HITId></HIT><HIT><HITId>3SR6AEG6W59ND5FUGJEOWHIQHA8HY1</HITId></HIT><HIT><HITId>366FYU4PTG5G9QZBM35R2662RF7KET</HITId></HIT><HIT><HITId>3AC6MFV69KYNIVPZC5G7AORSN4CHZS</HITId></HIT><HIT><HITId>3VO4XFFP152HBEIWC0BISIQU4YVQ75</HITId></HIT><HIT><HITId>3ZUE82NE0AHOK3X68PSUUJIB8GSF8N</HITId></HIT><HIT><HITId>3HRWUH63QUIHLDRL8F44Q4HT8HDN50</HITId></HIT><HIT><HITId>3L1EFR8WWTLOY8GGDHY8UFDMSMAF9C</HITId></HIT><HIT><HITId>3XABXM4AJ1LLBSNFM53O6IMPFI1Q8S</HITId></HIT><HIT><HITId>39AYGO6AFF0D4HRZDYE9IAVT4CON6G</HITId></HIT><HIT><HITId>3JHB4BPSFKPLPX6PRX926EH0ZOJQ9H</HITId></HIT><HIT><HITId>3O2Y2UIUCQA8F4Z7HEPXKOR23GMKFB</HITId></HIT><HIT><HITId>37VHPF5VYCJHHRDWHN2TMDX8B318C6</HITId></HIT><HIT><HITId>3SSN80MU8C4PFQQSH8VJQVR97LIXKF</HITId></HIT><HIT><HITId>32LAQ1JNT95W15MK6CYO7FF1WGSUTQ</HITId></HIT><HIT><HITId>3XBXDSS888Z0ZW8A287K5V4OWLNXLI</HITId></HIT><HIT><HITId>3XWUWJ18TL6B1I196HOYCB13FUZUUH</HITId></HIT><HIT><HITId>3QGTX7BCHPIB2254B3FYLRO2IVM5Z0</HITId></HIT><HIT><HITId>3P7QK0GJ3T1J35MHTKD0NKLQYLV2ZW</HITId></HIT><HIT><HITId>3SMIWMMK61LOTMQE1H3ZUZM00AAUWG</HITId></HIT><HIT><HITId>3NI0WFPPI9WAJLZSCSCB7YZGWJE60P</HITId></HIT><HIT><HITId>3Y40HMYLL1Y3IMV4BMZLWI079CGUX9</HITId></HIT><HIT><HITId>3MZ3TAMYTL3ECZES864FOXQ8E09RI3</HITId></HIT><HIT><HITId>33N1S8XHHM1CEK4LAGDMI1BL6FHZ1C</HITId></HIT><HIT><HITId>3MD8CKRQZZ3A7AYYQOPF0Y58RFYRJF</HITId></HIT><HIT><HITId>37AQKJ12TX4H1S7V678E2JTZD2MTTZ</HITId></HIT><HIT><HITId>32LAQ1JNT95W15MK6CYO7FF1WGTTUQ</HITId></HIT><HIT><HITId>371QPA24C24GS8VM4OO4WDA4LJW1TZ</HITId></HIT><HIT><HITId>338431Z1FLVO8LPV61HK8UMUQ98ROY</HITId></HIT><HIT><HITId>3P0I4CQYVYNTGH6H5VRQVTUBIONWO6</HITId></HIT><HIT><HITId>3YCT0L9OMMPIRFPWKBHCJFRLM1MNS3</HITId></HIT><HIT><HITId>3YOAVL4CA0XT6J14XYWOGZIOIZRZ4P</HITId></HIT><HIT><HITId>3DTJ4WT8BDVBYLYXM481PLUFVOLZEV</HITId></HIT><HIT><HITId>3VP28W7DUN034ZYTHFS773FF7P0ZFD</HITId></HIT><HIT><HITId>3R868ACW4SS9IZUOSZYPPOFR840ZGC</HITId></HIT><HIT><HITId>3HO4MYYR124QZ7B8AZQVW5NNC8IU6G</HITId></HIT><HIT><HITId>3SMIWMMK61LOTMQE1H3ZUZM00ABWUJ</HITId></HIT><HIT><HITId>3A9LA2FRWSUYD0PKBNSMD3BHF53XH2</HITId></HIT><HIT><HITId>3XQ4XW3OD9SM2T03YSJSRRONB7K2SI</HITId></HIT><HIT><HITId>3QI9WAYOGQRAKUJ4LUVVH45ZRCLS6O</HITId></HIT><HIT><HITId>3NZ1E5QA6ZHFK42O5PZVZ9HZRTP5BL</HITId></HIT></GetReviewableHITsResult></GetReviewableHITsResponse>
38
+ http_version:
39
+ recorded_at: Sat, 08 Apr 2017 02:56:55 GMT
40
+ - request:
41
+ method: post
42
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
43
+ body:
44
+ encoding: UTF-8
45
+ string: PageSize=100&PageNumber=2&Operation=GetReviewableHITs&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T02%3A56%3A55Z&Version=2012-03-25&Signature=g2Ykuyghy3Vw5X5KgVuOUKBkKiQ%3D
46
+ headers:
47
+ Accept:
48
+ - "*/*"
49
+ Accept-Encoding:
50
+ - gzip, deflate
51
+ User-Agent:
52
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
53
+ Content-Length:
54
+ - '219'
55
+ Host:
56
+ - mechanicalturk.sandbox.amazonaws.com
57
+ response:
58
+ status:
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ Content-Type:
63
+ - text/xml
64
+ Transfer-Encoding:
65
+ - chunked
66
+ Date:
67
+ - Sat, 08 Apr 2017 02:56:56 GMT
68
+ Server:
69
+ - MTurk
70
+ body:
71
+ encoding: UTF-8
72
+ string: |-
73
+ <?xml version="1.0"?>
74
+ <GetReviewableHITsResponse><OperationRequest><RequestId>9b74781b-b082-4897-8fc2-fc44d185946c</RequestId></OperationRequest><GetReviewableHITsResult><Request><IsValid>True</IsValid></Request><NumResults>0</NumResults><TotalNumResults>79</TotalNumResults><PageNumber>2</PageNumber></GetReviewableHITsResult></GetReviewableHITsResponse>
75
+ http_version:
76
+ recorded_at: Sat, 08 Apr 2017 02:56:56 GMT
77
+ - request:
78
+ method: post
79
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
80
+ body:
81
+ encoding: UTF-8
82
+ string: HITId=3A9LA2FRWSUYD0PKBNSMD3BHF53XH2&PageSize=100&Operation=GetAssignmentsForHIT&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T02%3A56%3A56Z&Version=2012-03-25&Signature=0DGyqjbyTp8V8JO5vCxfVTLxhxY%3D
83
+ headers:
84
+ Accept:
85
+ - "*/*"
86
+ Accept-Encoding:
87
+ - gzip, deflate
88
+ User-Agent:
89
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
90
+ Content-Length:
91
+ - '246'
92
+ Host:
93
+ - mechanicalturk.sandbox.amazonaws.com
94
+ response:
95
+ status:
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ Content-Type:
100
+ - text/xml
101
+ Transfer-Encoding:
102
+ - chunked
103
+ Date:
104
+ - Sat, 08 Apr 2017 02:56:56 GMT
105
+ Server:
106
+ - MTurk
107
+ body:
108
+ encoding: UTF-8
109
+ string: |-
110
+ <?xml version="1.0"?>
111
+ <GetAssignmentsForHITResponse><OperationRequest><RequestId>280d5d73-9091-4cb3-8c40-42fc6c263e54</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><Assignment><AssignmentId>3UNH76FOCTLCR3EZXIZ2D6M2BKIYMT</AssignmentId><WorkerId>A108A5T4U9V27P</WorkerId><HITId>3A9LA2FRWSUYD0PKBNSMD3BHF53XH2</HITId><AssignmentStatus>Rejected</AssignmentStatus><AutoApprovalTime>2017-04-08T03:01:12Z</AutoApprovalTime><AcceptTime>2017-04-08T02:56:00Z</AcceptTime><SubmitTime>2017-04-08T02:56:12Z</SubmitTime><RejectionTime>2017-04-08T02:56:35Z</RejectionTime><Answer>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
112
+ &lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"&gt;
113
+ &lt;Answer&gt;
114
+ &lt;QuestionIdentifier&gt;typingpool_url&lt;/QuestionIdentifier&gt;
115
+ &lt;FreeText&gt;https://webmasher.com/mturk/Typingpool%27s%20Test%20%26%20Interview.00.44.79b213c7bdd466ea9ae71a71f7882931.PPSVFV.mp3&lt;/FreeText&gt;
116
+ &lt;/Answer&gt;
117
+ &lt;Answer&gt;
118
+ &lt;QuestionIdentifier&gt;typingpool_project_id&lt;/QuestionIdentifier&gt;
119
+ &lt;FreeText&gt;79b213c7bdd466ea9ae71a71f7882931&lt;/FreeText&gt;
120
+ &lt;/Answer&gt;
121
+ &lt;Answer&gt;
122
+ &lt;QuestionIdentifier&gt;transcription&lt;/QuestionIdentifier&gt;
123
+ &lt;FreeText&gt;blah im lazy&lt;/FreeText&gt;
124
+ &lt;/Answer&gt;
125
+ &lt;/QuestionFormAnswers&gt;
126
+ </Answer></Assignment></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
127
+ http_version:
128
+ recorded_at: Sat, 08 Apr 2017 02:56:57 GMT
129
+ - request:
130
+ method: post
131
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
132
+ body:
133
+ encoding: UTF-8
134
+ string: HITId=3NZ1E5QA6ZHFK42O5PZVZ9HZRTP5BL&PageSize=100&Operation=GetAssignmentsForHIT&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T02%3A56%3A57Z&Version=2012-03-25&Signature=KEfQyr0ExMfdTbs%2FNmP0kUcW%2Bfs%3D
135
+ headers:
136
+ Accept:
137
+ - "*/*"
138
+ Accept-Encoding:
139
+ - gzip, deflate
140
+ User-Agent:
141
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
142
+ Content-Length:
143
+ - '250'
144
+ Host:
145
+ - mechanicalturk.sandbox.amazonaws.com
146
+ response:
147
+ status:
148
+ code: 200
149
+ message: OK
150
+ headers:
151
+ Content-Type:
152
+ - text/xml
153
+ Transfer-Encoding:
154
+ - chunked
155
+ Date:
156
+ - Sat, 08 Apr 2017 02:56:57 GMT
157
+ Server:
158
+ - MTurk
159
+ body:
160
+ encoding: UTF-8
161
+ string: |-
162
+ <?xml version="1.0"?>
163
+ <GetAssignmentsForHITResponse><OperationRequest><RequestId>f4bb1711-375c-4aa7-86ea-efcd0c8b5312</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><Assignment><AssignmentId>30X31N5D646ETGT119H8MT310IYAS8</AssignmentId><WorkerId>A108A5T4U9V27P</WorkerId><HITId>3NZ1E5QA6ZHFK42O5PZVZ9HZRTP5BL</HITId><AssignmentStatus>Approved</AssignmentStatus><AutoApprovalTime>2017-04-08T03:00:47Z</AutoApprovalTime><AcceptTime>2017-04-08T02:55:43Z</AcceptTime><SubmitTime>2017-04-08T02:55:47Z</SubmitTime><ApprovalTime>2017-04-08T02:56:28Z</ApprovalTime><Answer>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
164
+ &lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"&gt;
165
+ &lt;Answer&gt;
166
+ &lt;QuestionIdentifier&gt;typingpool_url&lt;/QuestionIdentifier&gt;
167
+ &lt;FreeText&gt;https://webmasher.com/mturk/Typingpool%27s%20Test%20%26%20Interview.01.28.79b213c7bdd466ea9ae71a71f7882931.QSTYUF.mp3&lt;/FreeText&gt;
168
+ &lt;/Answer&gt;
169
+ &lt;Answer&gt;
170
+ &lt;QuestionIdentifier&gt;typingpool_project_id&lt;/QuestionIdentifier&gt;
171
+ &lt;FreeText&gt;79b213c7bdd466ea9ae71a71f7882931&lt;/FreeText&gt;
172
+ &lt;/Answer&gt;
173
+ &lt;Answer&gt;
174
+ &lt;QuestionIdentifier&gt;transcription&lt;/QuestionIdentifier&gt;
175
+ &lt;FreeText&gt;Ryan: I'm still reading through your archive -- but I look forward to finishing it because I'm really interested in these issues.&amp;#13;
176
+ &amp;#13;
177
+ Havi: Ya I think it was a really interesting.... theme that came out during that election that's one of the themese that truly led to reporting on it &amp;#13;
178
+ &amp;#13;
179
+ Ryan: Ya.&amp;#13;
180
+ &amp;#13;
181
+ Havi: ....outside of my work plans was that theme of um&amp;#13;
182
+ &lt;/FreeText&gt;
183
+ &lt;/Answer&gt;
184
+ &lt;/QuestionFormAnswers&gt;
185
+ </Answer></Assignment></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
186
+ http_version:
187
+ recorded_at: Sat, 08 Apr 2017 02:56:58 GMT
188
+ recorded_with: VCR 3.0.3
@@ -0,0 +1,187 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
6
+ body:
7
+ encoding: UTF-8
8
+ string: PageSize=100&PageNumber=1&Operation=GetReviewableHITs&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T03%3A04%3A36Z&Version=2012-03-25&Signature=sgfxvVuxHADu%2BJWeHWGye7x9%2Fe0%3D
9
+ headers:
10
+ Accept:
11
+ - "*/*"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
16
+ Content-Length:
17
+ - '223'
18
+ Host:
19
+ - mechanicalturk.sandbox.amazonaws.com
20
+ response:
21
+ status:
22
+ code: 200
23
+ message: OK
24
+ headers:
25
+ Content-Type:
26
+ - text/xml
27
+ Transfer-Encoding:
28
+ - chunked
29
+ Date:
30
+ - Sat, 08 Apr 2017 03:04:36 GMT
31
+ Server:
32
+ - MTurk
33
+ body:
34
+ encoding: UTF-8
35
+ string: |-
36
+ <?xml version="1.0"?>
37
+ <GetReviewableHITsResponse><OperationRequest><RequestId>ff423321-845a-4c9d-b4db-e38dffb104bf</RequestId></OperationRequest><GetReviewableHITsResult><Request><IsValid>True</IsValid></Request><NumResults>81</NumResults><TotalNumResults>81</TotalNumResults><PageNumber>1</PageNumber><HIT><HITId>3WA2XVDZEMX9ABEMKZBQSN1KQKME6H</HITId></HIT><HIT><HITId>3WYZV0QBFJTOMNMYBVIQRS8JKR8BX8</HITId></HIT><HIT><HITId>3QE4DGPGBRRTF26Z768ZVS2I79VG4F</HITId></HIT><HIT><HITId>36GJS3V78V6JIKPKADV31UR1P6LGJ6</HITId></HIT><HIT><HITId>3EKZL9T8Y82AA2EPKRWZZQQ7EMPCHN</HITId></HIT><HIT><HITId>3IKDQS3DQEGA6XP9Q9EKZ2RMEZ4CIG</HITId></HIT><HIT><HITId>3KL228NDMV2ET4V2SYVF29RE4VLGK5</HITId></HIT><HIT><HITId>3FBEFUUYRKL6KYXA4U94W4BT55P6AF</HITId></HIT><HIT><HITId>3FI30CQHVKZB3822A890RFVZNNA6BA</HITId></HIT><HIT><HITId>3RWB1RTQDJ30BGM0MSOZ6DWFAMF8PJ</HITId></HIT><HIT><HITId>386659BNTLXFCZYV6M0UC28ZO8X10L</HITId></HIT><HIT><HITId>3D42WVSDH8B3Z9OOLTQOTW6D1VUYFJ</HITId></HIT><HIT><HITId>3PEG1BH7AE7I2NNRCC311Y0HOIUBKK</HITId></HIT><HIT><HITId>37SQU136V74FJOJD254UQ7R9T0311O</HITId></HIT><HIT><HITId>37SOB9Z0SSDOJY1WIJ0WYFFKPQM3LO</HITId></HIT><HIT><HITId>3UXQ63NLAA2TMT59XCF2GYDWDIZBLN</HITId></HIT><HIT><HITId>3Q2T3FD0ONO8PGJHIV1BYSU9PVC3MQ</HITId></HIT><HIT><HITId>3D7VY91L65DDSBNUXOGHGBSLDNPBMP</HITId></HIT><HIT><HITId>3TZDZ3Y0JSMX8TM86IJN5D9SRCR19X</HITId></HIT><HIT><HITId>36AZSFEYZ4GWIYH3BGH837BY4G1BV6</HITId></HIT><HIT><HITId>33NOQL7T9OFUPKO691M1XBYTKLM8Z4</HITId></HIT><HIT><HITId>3HFWPF5AK9ZBNBWM2SXXA1TFHKU3S2</HITId></HIT><HIT><HITId>30ZKOOGW2WMBDCWDYOXN18KCXU91AC</HITId></HIT><HIT><HITId>306996CF6W0GWM1542XJWJ4IFCU1B7</HITId></HIT><HIT><HITId>3UDTAB6HH6FX141QAZFNR8QIMKL902</HITId></HIT><HIT><HITId>3APP19WN71U7UPADQU1ESQMW3026GR</HITId></HIT><HIT><HITId>3HY86PZXPYYE3PDPETZ9XRA3I971E7</HITId></HIT><HIT><HITId>37VUR2VJ6A5Z6RTBI2TE73A0XXUC1P</HITId></HIT><HIT><HITId>3Z8UJEJOCZTTIW0NTMX6T6OPPW593X</HITId></HIT><HIT><HITId>3BCRDCM0ODACWB6WGLMTQIEPAHJ6KU</HITId></HIT><HIT><HITId>3PKVGQTFIH002ZTXCOQIALKW4J5YRE</HITId></HIT><HIT><HITId>3O0M2G5VC6IE0SJRT02P3BGV3W194I</HITId></HIT><HIT><HITId>3GS542CVJV3WWBNR75LZ83M93SW95N</HITId></HIT><HIT><HITId>3PGQRAZX020C3ETARDQN0VPSQLOYS2</HITId></HIT><HIT><HITId>3TFJJUELSH56VCB716TSCMK5P38C26</HITId></HIT><HIT><HITId>38B7Q9C28GLSFFN5COV40909ZN7963</HITId></HIT><HIT><HITId>3ZURAPD2883693DL94JFF9V3UAM1FP</HITId></HIT><HIT><HITId>3RDTX9JRTYHBJF1AVY0W6N05UYR972</HITId></HIT><HIT><HITId>3PZDSVZ3J5XZPUNLUALULCBF8LIN4V</HITId></HIT><HIT><HITId>3SR6AEG6W59ND5FUGJEOWHIQHA8HY1</HITId></HIT><HIT><HITId>366FYU4PTG5G9QZBM35R2662RF7KET</HITId></HIT><HIT><HITId>3AC6MFV69KYNIVPZC5G7AORSN4CHZS</HITId></HIT><HIT><HITId>3VO4XFFP152HBEIWC0BISIQU4YVQ75</HITId></HIT><HIT><HITId>3ZUE82NE0AHOK3X68PSUUJIB8GSF8N</HITId></HIT><HIT><HITId>3HRWUH63QUIHLDRL8F44Q4HT8HDN50</HITId></HIT><HIT><HITId>3L1EFR8WWTLOY8GGDHY8UFDMSMAF9C</HITId></HIT><HIT><HITId>3XABXM4AJ1LLBSNFM53O6IMPFI1Q8S</HITId></HIT><HIT><HITId>39AYGO6AFF0D4HRZDYE9IAVT4CON6G</HITId></HIT><HIT><HITId>3JHB4BPSFKPLPX6PRX926EH0ZOJQ9H</HITId></HIT><HIT><HITId>3O2Y2UIUCQA8F4Z7HEPXKOR23GMKFB</HITId></HIT><HIT><HITId>37VHPF5VYCJHHRDWHN2TMDX8B318C6</HITId></HIT><HIT><HITId>3SSN80MU8C4PFQQSH8VJQVR97LIXKF</HITId></HIT><HIT><HITId>32LAQ1JNT95W15MK6CYO7FF1WGSUTQ</HITId></HIT><HIT><HITId>3XBXDSS888Z0ZW8A287K5V4OWLNXLI</HITId></HIT><HIT><HITId>3XWUWJ18TL6B1I196HOYCB13FUZUUH</HITId></HIT><HIT><HITId>3QGTX7BCHPIB2254B3FYLRO2IVM5Z0</HITId></HIT><HIT><HITId>3P7QK0GJ3T1J35MHTKD0NKLQYLV2ZW</HITId></HIT><HIT><HITId>3SMIWMMK61LOTMQE1H3ZUZM00AAUWG</HITId></HIT><HIT><HITId>3NI0WFPPI9WAJLZSCSCB7YZGWJE60P</HITId></HIT><HIT><HITId>3Y40HMYLL1Y3IMV4BMZLWI079CGUX9</HITId></HIT><HIT><HITId>3MZ3TAMYTL3ECZES864FOXQ8E09RI3</HITId></HIT><HIT><HITId>33N1S8XHHM1CEK4LAGDMI1BL6FHZ1C</HITId></HIT><HIT><HITId>3MD8CKRQZZ3A7AYYQOPF0Y58RFYRJF</HITId></HIT><HIT><HITId>37AQKJ12TX4H1S7V678E2JTZD2MTTZ</HITId></HIT><HIT><HITId>32LAQ1JNT95W15MK6CYO7FF1WGTTUQ</HITId></HIT><HIT><HITId>371QPA24C24GS8VM4OO4WDA4LJW1TZ</HITId></HIT><HIT><HITId>338431Z1FLVO8LPV61HK8UMUQ98ROY</HITId></HIT><HIT><HITId>3P0I4CQYVYNTGH6H5VRQVTUBIONWO6</HITId></HIT><HIT><HITId>3YCT0L9OMMPIRFPWKBHCJFRLM1MNS3</HITId></HIT><HIT><HITId>3YOAVL4CA0XT6J14XYWOGZIOIZRZ4P</HITId></HIT><HIT><HITId>3DTJ4WT8BDVBYLYXM481PLUFVOLZEV</HITId></HIT><HIT><HITId>3VP28W7DUN034ZYTHFS773FF7P0ZFD</HITId></HIT><HIT><HITId>3R868ACW4SS9IZUOSZYPPOFR840ZGC</HITId></HIT><HIT><HITId>3HO4MYYR124QZ7B8AZQVW5NNC8IU6G</HITId></HIT><HIT><HITId>3SMIWMMK61LOTMQE1H3ZUZM00ABWUJ</HITId></HIT><HIT><HITId>3R5LWXWHR0OKD4U9RHA4S3ZG05QXG3</HITId></HIT><HIT><HITId>3A9LA2FRWSUYD0PKBNSMD3BHF53XH2</HITId></HIT><HIT><HITId>3XU9MCX6VOSA1E0QJ3JN1HJRP512RU</HITId></HIT><HIT><HITId>3XQ4XW3OD9SM2T03YSJSRRONB7K2SI</HITId></HIT><HIT><HITId>3QI9WAYOGQRAKUJ4LUVVH45ZRCLS6O</HITId></HIT><HIT><HITId>3NZ1E5QA6ZHFK42O5PZVZ9HZRTP5BL</HITId></HIT></GetReviewableHITsResult></GetReviewableHITsResponse>
38
+ http_version:
39
+ recorded_at: Sat, 08 Apr 2017 03:04:36 GMT
40
+ - request:
41
+ method: post
42
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
43
+ body:
44
+ encoding: UTF-8
45
+ string: PageSize=100&PageNumber=2&Operation=GetReviewableHITs&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T03%3A04%3A36Z&Version=2012-03-25&Signature=sgfxvVuxHADu%2BJWeHWGye7x9%2Fe0%3D
46
+ headers:
47
+ Accept:
48
+ - "*/*"
49
+ Accept-Encoding:
50
+ - gzip, deflate
51
+ User-Agent:
52
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
53
+ Content-Length:
54
+ - '223'
55
+ Host:
56
+ - mechanicalturk.sandbox.amazonaws.com
57
+ response:
58
+ status:
59
+ code: 200
60
+ message: OK
61
+ headers:
62
+ Content-Type:
63
+ - text/xml
64
+ Transfer-Encoding:
65
+ - chunked
66
+ Date:
67
+ - Sat, 08 Apr 2017 03:04:36 GMT
68
+ Server:
69
+ - MTurk
70
+ body:
71
+ encoding: UTF-8
72
+ string: |-
73
+ <?xml version="1.0"?>
74
+ <GetReviewableHITsResponse><OperationRequest><RequestId>a79d2bcd-8ce2-4ecc-97b5-9b198a65fc38</RequestId></OperationRequest><GetReviewableHITsResult><Request><IsValid>True</IsValid></Request><NumResults>0</NumResults><TotalNumResults>81</TotalNumResults><PageNumber>2</PageNumber></GetReviewableHITsResult></GetReviewableHITsResponse>
75
+ http_version:
76
+ recorded_at: Sat, 08 Apr 2017 03:04:37 GMT
77
+ - request:
78
+ method: post
79
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
80
+ body:
81
+ encoding: UTF-8
82
+ string: HITId=3R5LWXWHR0OKD4U9RHA4S3ZG05QXG3&PageSize=100&Operation=GetAssignmentsForHIT&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T03%3A04%3A37Z&Version=2012-03-25&Signature=fECYM7w%2Fb%2Bnsj4%2FQ%2FOKk7B2Oitc%3D
83
+ headers:
84
+ Accept:
85
+ - "*/*"
86
+ Accept-Encoding:
87
+ - gzip, deflate
88
+ User-Agent:
89
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
90
+ Content-Length:
91
+ - '254'
92
+ Host:
93
+ - mechanicalturk.sandbox.amazonaws.com
94
+ response:
95
+ status:
96
+ code: 200
97
+ message: OK
98
+ headers:
99
+ Content-Type:
100
+ - text/xml
101
+ Transfer-Encoding:
102
+ - chunked
103
+ Date:
104
+ - Sat, 08 Apr 2017 03:04:37 GMT
105
+ Server:
106
+ - MTurk
107
+ body:
108
+ encoding: UTF-8
109
+ string: |-
110
+ <?xml version="1.0"?>
111
+ <GetAssignmentsForHITResponse><OperationRequest><RequestId>ddf80b24-7e68-43bb-9680-ea627a50b91e</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><Assignment><AssignmentId>39KFRKBFIOB0R6ZBAYEF5AB76KXYO8</AssignmentId><WorkerId>A108A5T4U9V27P</WorkerId><HITId>3R5LWXWHR0OKD4U9RHA4S3ZG05QXG3</HITId><AssignmentStatus>Approved</AssignmentStatus><AutoApprovalTime>2017-04-08T03:03:08Z</AutoApprovalTime><AcceptTime>2017-04-08T02:57:58Z</AcceptTime><SubmitTime>2017-04-08T02:58:08Z</SubmitTime><ApprovalTime>2017-04-08T02:58:29Z</ApprovalTime><Answer>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
112
+ &lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"&gt;
113
+ &lt;Answer&gt;
114
+ &lt;QuestionIdentifier&gt;typingpool_url&lt;/QuestionIdentifier&gt;
115
+ &lt;FreeText&gt;https://webmasher.com/mturk/Typingpool%27s%20Test%20%26%20Interview.00.00.79b213c7bdd466ea9ae71a71f7882931.HDMJGC.mp3&lt;/FreeText&gt;
116
+ &lt;/Answer&gt;
117
+ &lt;Answer&gt;
118
+ &lt;QuestionIdentifier&gt;typingpool_project_id&lt;/QuestionIdentifier&gt;
119
+ &lt;FreeText&gt;79b213c7bdd466ea9ae71a71f7882931&lt;/FreeText&gt;
120
+ &lt;/Answer&gt;
121
+ &lt;Answer&gt;
122
+ &lt;QuestionIdentifier&gt;transcription&lt;/QuestionIdentifier&gt;
123
+ &lt;FreeText&gt;Ryan: This is probably a dumb question but in Grand Rapids -- are you guys connected to the auto industry or are you too far from Detroit to be...&amp;#13;
124
+ &amp;#13;
125
+ Havi: We are. We're connected to the buyers for the auto industry in Detroit and Flint. It's kind of a - it's a statewide business here but We definitely get our&amp;#13;
126
+ &lt;/FreeText&gt;
127
+ &lt;/Answer&gt;
128
+ &lt;/QuestionFormAnswers&gt;
129
+ </Answer></Assignment></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
130
+ http_version:
131
+ recorded_at: Sat, 08 Apr 2017 03:04:37 GMT
132
+ - request:
133
+ method: post
134
+ uri: https://mechanicalturk.sandbox.amazonaws.com/
135
+ body:
136
+ encoding: UTF-8
137
+ string: HITId=3XU9MCX6VOSA1E0QJ3JN1HJRP512RU&PageSize=100&Operation=GetAssignmentsForHIT&Service=AWSMechanicalTurkRequester&AWSAccessKeyId=<AWS_KEY>&Timestamp=2017-04-08T03%3A04%3A37Z&Version=2012-03-25&Signature=fECYM7w%2Fb%2Bnsj4%2FQ%2FOKk7B2Oitc%3D
138
+ headers:
139
+ Accept:
140
+ - "*/*"
141
+ Accept-Encoding:
142
+ - gzip, deflate
143
+ User-Agent:
144
+ - rest-client/2.0.0 (darwin15.6.0 x86_64) ruby/2.3.3p222
145
+ Content-Length:
146
+ - '254'
147
+ Host:
148
+ - mechanicalturk.sandbox.amazonaws.com
149
+ response:
150
+ status:
151
+ code: 200
152
+ message: OK
153
+ headers:
154
+ Content-Type:
155
+ - text/xml
156
+ Transfer-Encoding:
157
+ - chunked
158
+ Date:
159
+ - Sat, 08 Apr 2017 03:04:37 GMT
160
+ Server:
161
+ - MTurk
162
+ body:
163
+ encoding: UTF-8
164
+ string: |-
165
+ <?xml version="1.0"?>
166
+ <GetAssignmentsForHITResponse><OperationRequest><RequestId>afe5ecb6-51ae-43a9-815f-27f6264b9e0c</RequestId></OperationRequest><GetAssignmentsForHITResult><Request><IsValid>True</IsValid></Request><NumResults>1</NumResults><TotalNumResults>1</TotalNumResults><PageNumber>1</PageNumber><Assignment><AssignmentId>3L6L49WXW1DYLPF9GCU9GF79UOU45P</AssignmentId><WorkerId>A108A5T4U9V27P</WorkerId><HITId>3XU9MCX6VOSA1E0QJ3JN1HJRP512RU</HITId><AssignmentStatus>Approved</AssignmentStatus><AutoApprovalTime>2017-04-08T03:02:54Z</AutoApprovalTime><AcceptTime>2017-04-08T02:57:41Z</AcceptTime><SubmitTime>2017-04-08T02:57:54Z</SubmitTime><ApprovalTime>2017-04-08T03:03:52Z</ApprovalTime><Answer>&lt;?xml version="1.0" encoding="UTF-8" standalone="no"?&gt;
167
+ &lt;QuestionFormAnswers xmlns="http://mechanicalturk.amazonaws.com/AWSMechanicalTurkDataSchemas/2005-10-01/QuestionFormAnswers.xsd"&gt;
168
+ &lt;Answer&gt;
169
+ &lt;QuestionIdentifier&gt;typingpool_url&lt;/QuestionIdentifier&gt;
170
+ &lt;FreeText&gt;https://webmasher.com/mturk/Typingpool%27s%20Test%20%26%20Interview.00.22.79b213c7bdd466ea9ae71a71f7882931.URYYEK.mp3&lt;/FreeText&gt;
171
+ &lt;/Answer&gt;
172
+ &lt;Answer&gt;
173
+ &lt;QuestionIdentifier&gt;typingpool_project_id&lt;/QuestionIdentifier&gt;
174
+ &lt;FreeText&gt;79b213c7bdd466ea9ae71a71f7882931&lt;/FreeText&gt;
175
+ &lt;/Answer&gt;
176
+ &lt;Answer&gt;
177
+ &lt;QuestionIdentifier&gt;transcription&lt;/QuestionIdentifier&gt;
178
+ &lt;FreeText&gt;Havi: We definitely get our side of it from the supply and manufacturing of parts and to -- a lot of tool and die, that kind of thing.&amp;#13;
179
+ &amp;#13;
180
+ Ryan: Ya. One of my other chapters -- I was just reading before I called -- like earlier today -- one of my other chapters is on Saturn and sort of how that was a grand skunkworks that had a really bright start, and then kind of just, fizzled&amp;#13;
181
+ &lt;/FreeText&gt;
182
+ &lt;/Answer&gt;
183
+ &lt;/QuestionFormAnswers&gt;
184
+ </Answer></Assignment></GetAssignmentsForHITResult></GetAssignmentsForHITResponse>
185
+ http_version:
186
+ recorded_at: Sat, 08 Apr 2017 03:04:37 GMT
187
+ recorded_with: VCR 3.0.3
@@ -2,347 +2,39 @@ module Typingpool
2
2
  class Test
3
3
  class Script < Test
4
4
  require 'typingpool'
5
- require 'yaml'
6
5
  require 'open3'
7
6
  require 'fileutils'
8
7
  require 'nokogiri'
8
+ require 'typingpool/utility/test/script'
9
9
 
10
- @@readymade_project_path = nil
10
+ include Utility::Test::Script
11
11
 
12
- def with_temp_readymade_project
13
- with_temp_transcripts_dir do |dir|
14
- setup_readymade_project_into(config_path(dir))
15
- yield(dir)
16
- end
17
- end
18
-
19
- def setup_readymade_project_into(config_path)
20
- init_readymade_project
21
- copy_readymade_project_into(config_path)
22
- reconfigure_readymade_project_in(config_path)
23
- end
24
-
25
- def init_readymade_project
26
- unless @@readymade_project_path
27
- dir = @@readymade_project_path = Dir.mktmpdir('typingpool_')
28
- Minitest.after_run{ FileUtils.remove_entry_secure(dir) }
29
- make_transcripts_dir_config(dir, Config.file(setup_s3_config(dir, self.config)))
30
- tp_make(dir, config_path(dir), 'mp3', true)
31
- end
32
- end
33
-
34
- def copy_readymade_project_into(config_path)
35
- FileUtils.cp_r(File.join(@@readymade_project_path, '.'), File.dirname(config_path))
36
- end
37
-
38
- def reconfigure_readymade_project_in(config_path)
39
- #rewrite URLs in assignment.csv according to config at config_path
40
- make_transcripts_dir_config(File.dirname(config_path), Config.file(config_path))
41
- project = Project.new(project_default[:title], Config.file(config_path))
42
- File.delete(project.local.file('data', 'id.txt'))
43
- project.local.create_id
44
- reconfigure_project_csv_in(config_path)
12
+ #Overrides method in Utility::Test::Script
13
+ def do_later
14
+ Minitest.after_run{ yield }
45
15
  end
46
16
 
47
- def reconfigure_project_csv_in(config_path)
48
- project = Project.new(project_default[:title], Config.file(config_path))
49
- assignments = project.local.file('data', 'assignment.csv').as(:csv)
50
- urls = project.create_remote_names(assignments.map{|assignment| Project.local_basename_from_url(assignment['audio_url']) }).map{|file| project.remote.file_to_url(file) }
51
- assignments.each! do |assignment|
52
- assignment['audio_url'] = urls.shift
53
- assignment['project_id'] = project.local.id
54
- end
55
- end
56
-
57
- def simulate_failed_audio_upload_in(dir, config_path=config_path(dir))
58
- project = Project.new(project_default[:title], Config.file(config_path))
59
- csv = project.local.file('data', 'assignment.csv').as(:csv)
60
- csv.each!{|a| a['audio_uploaded'] = 'maybe'}
61
- end
62
-
63
- def audio_files(subdir='mp3')
64
- dir = File.join(audio_dir, subdir)
65
- Dir.entries(dir).reject{|entry| entry.match(/^\./) }.map{|entry| File.join(dir, entry)}.select{|path| File.file?(path) }
66
- end
67
-
68
- def config_path(dir)
69
- File.join(dir, project_default[:config_filename])
70
- end
71
-
72
- def with_temp_transcripts_dir
73
- Dir.mktmpdir('typingpool_') do |dir|
74
- make_transcripts_dir_config(dir, self.config)
75
- yield(dir)
76
- end
77
- end
78
-
79
- def setup_s3_config(dir, config=Config.file(config_path(dir)), filename='.config_s3')
80
- return unless s3_credentials?(config)
81
- config.to_hash.delete('sftp')
82
- write_config(config, dir, filename)
83
- end
84
-
85
- def setup_s3_config_with_bad_password(dir, config=Config.file(config_path(dir)))
17
+ def write_s3_config_with_bad_password(dir, config=Config.file(config_path(dir)))
86
18
  bad_password = 'f'
87
19
  refute_equal(config.to_hash['amazon']['secret'], bad_password)
88
20
  config.to_hash['amazon']['secret'] = bad_password
89
- setup_s3_config(dir, config, '.config_s3_bad')
90
- end
91
-
92
- def make_transcripts_dir_config(dir, config=self.config)
93
- config.transcripts = dir
94
- config.cache = File.join(dir, '.cache')
95
- config['assign']['reward'] = '0.02'
96
- config.assign.to_hash.delete('qualify')
97
- write_config(config, dir, project_default[:config_filename])
98
- end
99
-
100
- def write_config(config, dir, filename=project_default[:config_filename])
101
- path = File.join(dir, filename)
102
- File.write(path, YAML.dump(config.to_hash))
103
- path
104
- end
105
-
106
- def transcripts_dir_project(dir, config=Config.file(config_path(dir)))
107
- Project.new(project_default[:title], config)
108
- end
109
-
110
- def call_script(script_name, *args)
111
- out, err, status = Open3.capture3(path_to_script(script_name), *args)
112
- if status.success?
113
- return [out.to_s.chomp, err.to_s.chomp]
114
- else
115
- if err
116
- raise Error::Shell, err.chomp
117
- else
118
- raise Error::Shell
119
- end
120
- end
121
- #Utility.system_quietly(path_to_script(script_name), *args)
122
- end
123
-
124
- def path_to_script(script_name)
125
- File.join(self.class.app_dir, 'bin', script_name)
126
- end
127
-
128
- def vcr_args(fixture_name)
129
- args = []
130
- if fixture = cleared_vcr_fixture_path_for(fixture_name)
131
- args.push('--testfixture', fixture)
132
- if Typingpool::Test.record
133
- args.push('--testfixturerecord')
134
- end
135
- end #if fixture = ...
136
- args
137
- end
138
-
139
- def call_tp_make(*args)
140
- call_script('tp-make', *args)
141
- end
142
-
143
- def tp_make(in_dir, config=config_path(in_dir), audio_subdir='mp3', devtest_mode_skipping_upload=false, *args)
144
- commands = [
145
- '--config', config,
146
- '--chunks', project_default[:chunks],
147
- *[:title, :subtitle].map{|param| ["--#{param}", project_default[param]] }.flatten,
148
- *[:voice, :unusual].map{|param| project_default[param].map{|value| ["--#{param}", value] } }.flatten,
149
- *audio_files(audio_subdir).map{|path| ['--file', path]}.flatten,
150
- *args
151
- ]
152
- commands.push('--testnoupload', '--testkeepmergefile') if devtest_mode_skipping_upload
153
- call_tp_make(*commands)
154
- end
155
-
156
- def tp_make_with_vcr(dir, fixture_name, config_path=config_path(dir))
157
- tp_make(dir, config_path, 'mp3', false, *vcr_args(fixture_name))
158
- end
159
-
160
- def call_tp_finish(*args)
161
- call_script('tp-finish', *args)
162
- end
163
-
164
- def tp_finish(dir, config_path=config_path(dir), *args)
165
- tp_finish_inside_sandbox(dir, config_path, *args)
166
- tp_finish_outside_sandbox(dir, config_path, *args)
21
+ write_config(dir, reconfigure_for_s3(config), '.config_s3_bad')
167
22
  end
168
23
 
169
24
 
170
- def tp_finish_inside_sandbox(dir, config_path=config_path(dir), *args)
171
- tp_finish_outside_sandbox(dir, config_path, '--sandbox', *args)
172
- end
173
-
174
- def tp_finish_outside_sandbox(dir, config_path=config_path(dir), *args)
175
- call_tp_finish(project_default[:title], '--config', config_path, *args)
176
- end
177
-
178
- def call_tp_assign(*args)
179
- call_script('tp-assign', '--sandbox', *args)
180
- end
181
-
182
- def assign_default
183
- Hash[
184
- :template => 'interview/phone',
185
- :deadline => '5h',
186
- :lifetime => '10h',
187
- :approval => '10h',
188
- :qualify => ['approval_rate >= 90', 'hits_approved > 10'],
189
- :keyword => ['test', 'mp3', 'typingpooltest']
190
- ]
191
- end
192
-
193
- def tp_assign(dir, config_path=config_path(dir), *args)
194
- call_tp_assign(
195
- project_default[:title],
196
- assign_default[:template],
197
- '--config', config_path,
198
- *[:deadline, :lifetime, :approval].map{|param| ["--#{param}", assign_default[param]] }.flatten,
199
- *[:qualify, :keyword].map{|param| assign_default[param].map{|value| ["--#{param}", value] } }.flatten,
200
- *args)
201
-
202
- end
203
-
204
- def tp_assign_with_vcr(dir, fixture_name, config_path=config_path(dir))
205
- project = transcripts_dir_project(dir, Typingpool::Config.file(config_path))
206
- args = [dir, config_path, *vcr_args(fixture_name)]
207
- unless (Typingpool::Test.live || Typingpool::Test.record)
208
- args.push('--testtime', project_time(project).to_i.to_s)
209
- end
210
- tp_assign(*args)
211
- end
212
-
213
- def copy_tp_assign_fixtures(dir, fixture_prefix, config_path=config_path(dir))
214
- project = transcripts_dir_project(dir, Typingpool::Config.file(config_path))
215
- if Typingpool::Test.record
216
- project_time(project, Time.now)
217
- with_fixtures_in_transcripts_dir(dir, "#{fixture_prefix}_") do |fixture_path, project_path|
218
- FileUtils.cp(project_path, fixture_path)
219
- end
220
- elsif not(Typingpool::Test.live)
221
- copy_fixtures_to_transcripts_dir(dir, "#{fixture_prefix}_")
222
- reconfigure_project_csv_in(config_path)
223
- end
224
- end
225
-
226
- def project_time(project, time=nil)
227
- file = project.local.file('data', 'time.txt')
228
- if time
229
- file.write(time.to_i)
230
- else
231
- time = Time.at(file.read.to_i)
232
- end
233
- time
234
- end
235
-
236
- def call_tp_collect(fixture_path, *args)
237
- call_script('tp-collect', '--sandbox', '--fixture', fixture_path, *args)
238
- end
239
-
240
- def tp_collect_with_fixture(dir, fixture_path)
241
- call_tp_collect(
242
- fixture_path,
243
- '--config', config_path(dir)
244
- )
245
- end
246
-
247
-
248
- def tp_review_with_fixture(dir, fixture_path, choices)
249
- output = {}
250
- Open3.popen3(File.join(self.class.app_dir, 'bin', 'tp-review'), '--sandbox', '--fixture', fixture_path, '--config', config_path(dir), project_default[:title]) do |stdin, stdout, stderr, wait_thr|
251
- choices.each do |choice|
252
- stdin.puts(choice)
253
- if choice.strip.match(/^r/i)
254
- stdin.puts("No reason - this is a test")
255
- end
256
- end
257
- output[:out] = stdout.gets(nil)
258
- output[:err] = stderr.gets(nil)
259
- [stdin, stdout, stderr].each{|stream| stream.close }
260
- output[:status] = wait_thr.value
261
- end
262
- output
263
- end
264
-
265
- def tp_config(*args)
266
- call_script('tp-config', *args)
267
- end
268
-
269
- def tp_config_with_input(args, input)
270
- output = {}
271
- Open3.popen3(path_to_script('tp-config'), *args) do |stdin, stdout, stderr, wait_thr|
272
- input.each do |sending|
273
- stdin.puts(sending)
274
- end
275
- output[:out] = stdout.gets(nil)
276
- output[:err] = stderr.gets(nil)
277
- [stdin, stdout, stderr].each{|stream| stream.close }
278
- output[:status] = wait_thr.value
279
- end #Open3.popen3...
280
- output
281
- end
282
-
283
- def fixture_project_dir(name)
284
- File.join(fixtures_dir, name)
285
- end
286
-
287
- def make_fixture_project_dir(name)
288
- dir = fixture_project_dir(name)
289
- if File.exist? dir
290
- raise Error::Test, "Fixture project already exists for #{name} at #{dir}"
291
- end
292
- Dir.mkdir(dir)
293
- dir
294
- end
295
-
296
- def remove_fixture_project_dir(name)
297
- FileUtils.remove_entry_secure(fixture_project_dir(name), :secure => true)
298
- end
299
-
300
- def with_fixtures_in_transcripts_dir(dir, fixture_prefix)
301
- fixtures = Dir.entries(fixtures_dir).select{|entry| entry.include?(fixture_prefix) && entry.index(fixture_prefix) == 0 }.select{|entry| File.file?(File.join(fixtures_dir, entry)) }
302
- fixtures.map!{|fixture| fixture[fixture_prefix.size .. -1] }
303
- fixtures.each do |fixture|
304
- project_path = File.join(transcripts_dir_project(dir).local, 'data', fixture)
305
- fixture_path = File.join(fixtures_dir, [fixture_prefix, fixture].join )
306
- yield(fixture_path, project_path)
307
- end
308
- end
309
-
310
- def copy_fixtures_to_transcripts_dir(dir, fixture_prefix)
311
- copies = 0
312
- with_fixtures_in_transcripts_dir(dir, fixture_prefix) do |fixture_path, project_path|
313
- if File.exist? project_path
314
- FileUtils.mv(project_path, File.join(File.dirname(project_path), "orig_#{File.basename(project_path)}"))
315
- end
316
- FileUtils.cp(fixture_path, project_path)
317
- copies += 1
318
- end
319
- copies > 0 or raise Error, "No fixtures to copy with prefix #{fixture_prefix} from dir #{dir}"
320
- copies
321
- end
322
-
323
- def rm_fixtures_from_transcripts_dir(dir, fixture_prefix)
324
- with_fixtures_in_transcripts_dir(dir, fixture_prefix) do |fixture_path, project_path|
325
- FileUtils.rm(project_path)
326
- path_to_orig = File.join(File.dirname(project_path), "orig_#{File.basename(project_path)}")
327
- if File.exist?(path_to_orig)
328
- FileUtils.mv(path_to_orig, project_path)
329
- end
330
- end
331
- end
332
-
333
- def assert_has_transcript(dir, transcript_file='transcript.html')
334
- transcript_path = File.join(transcripts_dir_project(dir).local, transcript_file)
25
+ def assert_has_transcript(project, transcript_file='transcript.html')
26
+ transcript_path = File.join(project.local, transcript_file)
335
27
  assert(File.exist?(transcript_path))
336
28
  assert(not((transcript = IO.read(transcript_path)).empty?))
337
29
  transcript
338
30
  end
339
31
 
340
- def assert_has_partial_transcript(dir)
341
- assert_has_transcript(dir, 'transcript_in_progress.html')
32
+ def assert_has_partial_transcript(project)
33
+ assert_has_transcript(project, 'transcript_in_progress.html')
342
34
  end
343
35
 
344
36
  def assert_assignment_csv_has_transcription_count(count, project, which_csv='assignment.csv')
345
- assert_equal(count, project.local.file('data', which_csv).as(:csv).reject{|assignment| assignment['transcript'].to_s.empty?}.size)
37
+ assert_equal(count, project_transcript_count(project, which_csv))
346
38
  end
347
39
 
348
40
  def assert_html_has_audio_count(count, html)
@@ -363,6 +55,7 @@ module Typingpool
363
55
  assert_match(regex, exception.message)
364
56
  end #with_temp_transcripts_dir do...
365
57
  end
58
+
366
59
  end #Script
367
60
  end #Test
368
61
  end #Typingpool