datasift 2.1.1 → 3.0.0.beta

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/CHANGELOG.md +100 -0
  4. data/Gemfile.lock +32 -0
  5. data/README.md +38 -79
  6. data/VERSION +1 -1
  7. data/datasift.gemspec +21 -24
  8. data/examples/auth.rb +44 -0
  9. data/examples/core_api_eg.rb +46 -0
  10. data/examples/historics_eg.rb +50 -0
  11. data/examples/historics_preview_eg.rb +30 -0
  12. data/examples/live_stream_eg.rb +89 -0
  13. data/examples/managed_source_eg.rb +56 -0
  14. data/examples/pull.rb +44 -0
  15. data/examples/push_eg.rb +56 -0
  16. data/lib/api/api_resource.rb +23 -0
  17. data/lib/datasift.rb +287 -14
  18. data/lib/errors.rb +59 -0
  19. data/lib/historics.rb +76 -0
  20. data/lib/historics_preview.rb +20 -0
  21. data/lib/live_stream.rb +53 -0
  22. data/lib/managed_source.rb +57 -0
  23. data/lib/push.rb +156 -0
  24. data/tests/core_api_test.rb +42 -0
  25. metadata +51 -73
  26. data/Rakefile +0 -34
  27. data/config.yml +0 -2
  28. data/examples/consume-stream.rb +0 -63
  29. data/examples/deletes.rb +0 -52
  30. data/examples/dpu.rb +0 -115
  31. data/examples/football-buffered.rb +0 -51
  32. data/examples/football.rb +0 -53
  33. data/examples/historics.sh +0 -2
  34. data/examples/historics/create-from-csdl.rb +0 -71
  35. data/examples/historics/create-from-hash.rb +0 -65
  36. data/examples/historics/delete.rb +0 -30
  37. data/examples/historics/env.rb +0 -37
  38. data/examples/historics/list.rb +0 -30
  39. data/examples/historics/start.rb +0 -30
  40. data/examples/historics/stop.rb +0 -30
  41. data/examples/historics/view.rb +0 -28
  42. data/examples/push.sh +0 -2
  43. data/examples/push/delete.rb +0 -33
  44. data/examples/push/env.rb +0 -53
  45. data/examples/push/list.rb +0 -30
  46. data/examples/push/pause.rb +0 -33
  47. data/examples/push/push-from-hash.rb +0 -72
  48. data/examples/push/push-historic-from-csdl.rb +0 -98
  49. data/examples/push/push-stream-from-csdl.rb +0 -70
  50. data/examples/push/resume.rb +0 -33
  51. data/examples/push/stop.rb +0 -33
  52. data/examples/push/view-log.rb +0 -45
  53. data/examples/push/view.rb +0 -31
  54. data/examples/twitter-track.rb +0 -61
  55. data/lib/DataSift/apiclient.rb +0 -73
  56. data/lib/DataSift/definition.rb +0 -202
  57. data/lib/DataSift/exceptions.rb +0 -33
  58. data/lib/DataSift/historic.rb +0 -316
  59. data/lib/DataSift/managed_source.rb +0 -263
  60. data/lib/DataSift/mockapiclient.rb +0 -44
  61. data/lib/DataSift/push_definition.rb +0 -115
  62. data/lib/DataSift/push_subscription.rb +0 -330
  63. data/lib/DataSift/stream_consumer.rb +0 -166
  64. data/lib/DataSift/stream_consumer_http.rb +0 -188
  65. data/lib/DataSift/user.rb +0 -311
  66. data/test/helper.rb +0 -95
  67. data/test/test_definition.rb +0 -273
  68. data/test/test_historics.rb +0 -233
  69. data/test/test_pushdefinition.rb +0 -92
  70. data/test/test_pushsubscription.rb +0 -17
  71. data/test/test_user.rb +0 -130
  72. data/test/testdata.yml +0 -30
@@ -1,95 +0,0 @@
1
- require 'rubygems'
2
- require 'test/unit'
3
- require 'shoulda'
4
- require 'yaml'
5
- require File.dirname(__FILE__) + '/../lib/DataSift/mockapiclient'
6
-
7
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
8
- $LOAD_PATH.unshift(File.dirname(__FILE__))
9
- require 'datasift'
10
-
11
- class Test::Unit::TestCase
12
- def init()
13
- @config = YAML::load(File.open(File.join(File.dirname(__FILE__), '..', 'config.yml')))
14
- @testdata = YAML::load(File.open(File.join(File.dirname(__FILE__), 'testdata.yml')))
15
-
16
- # Initialise the test data (parse the dates, etc).
17
- @testdata['historic_start'] = DateTime.parse(@testdata['historic_start'].to_s)
18
- @testdata['historic_end'] = DateTime.parse(@testdata['historic_end'].to_s)
19
- @testdata['historic_created_at'] = DateTime.parse(@testdata['historic_created_at'].to_s)
20
- @testdata['push_created_at'] = DateTime.parse(@testdata['push_created_at'].to_s)
21
- @testdata['push_last_request'] = DateTime.parse(@testdata['push_last_request'].to_s)
22
- @testdata['push_last_success'] = DateTime.parse(@testdata['push_last_success'].to_s)
23
- @testdata['historic_sources'] = @testdata['historic_sources'].split(',')
24
-
25
- @user = DataSift::User.new(@config['username'], @config['api_key'])
26
- @user.setApiClient(DataSift::MockApiClient.new())
27
- @user.api_client.clearResponse()
28
- end
29
-
30
- def set204Response()
31
- @user.api_client.setResponse(204, {}, 200, 150)
32
- end
33
-
34
- def setResponseToASingleHistoric(changes = {})
35
- data = {
36
- 'id' => @testdata['historic_playback_id'],
37
- 'definition_id' => @testdata['definition_hash'],
38
- 'name' => @testdata['historic_name'],
39
- 'start' => @testdata['historic_start'].strftime('%s'),
40
- 'end' => @testdata['historic_end'].strftime('%s'),
41
- 'created_at' => @testdata['historic_created_at'].strftime('%s'),
42
- 'status' => @testdata['historic_status'],
43
- 'progress' => 0,
44
- 'sources' => @testdata['historic_sources'],
45
- 'sample' => @testdata['historic_sample'],
46
- }
47
- @user.api_client.setResponse(200, data.merge(changes), 200, 150)
48
- end
49
-
50
- def configurePushDefinition(push)
51
- push.output_type = @testdata['push_output_type']
52
- @testdata['push_output_params'].each { |k,v| push.output_params[k] = v }
53
- end
54
-
55
- def setResponseToASingleSubscription(changes = {})
56
- data = {
57
- 'id' => @testdata['push_id'],
58
- 'name' => @testdata['push_name'],
59
- 'created_at' => @testdata['push_created_at'].strftime('%s'),
60
- 'status' => @testdata['push_status'],
61
- 'hash' => @testdata['definition_hash'],
62
- 'hash_type' => @testdata['push_hash_type'],
63
- 'output_type' => @testdata['push_output_type'],
64
- 'output_params' => {
65
- 'delivery_frequency' => @testdata['push_output_params']['delivery_frequency'],
66
- 'url' => @testdata['push_output_params']['url'],
67
- 'auth' => {
68
- 'type' => @testdata['push_output_params']['auth_type'],
69
- 'username' => @testdata['push_output_params']['auth_username'],
70
- 'password' => @testdata['push_output_params']['auth_password'],
71
- },
72
- },
73
- 'last_request' => @testdata['push_last_request'].strftime('%s'),
74
- 'last_success' => @testdata['push_last_success'].strftime('%s'),
75
- }
76
- @user.api_client.setResponse(200, data.merge(changes), 200, 150)
77
- end
78
-
79
- def checkSubscription(subscription)
80
- assert_equal @testdata['push_id'], subscription.id
81
- assert_equal @testdata['push_name'], subscription.name
82
- assert_equal @testdata['push_created_at'], subscription.created_at
83
- assert_equal @testdata['push_status'], subscription.status
84
- assert_equal @testdata['definition_hash'], subscription.hash
85
- assert_equal @testdata['push_hash_type'], subscription.hash_type
86
- assert_equal @testdata['push_output_type'], subscription.output_type
87
- assert_equal @testdata['push_output_params']['delivery_frequency'], subscription.output_params['delivery_frequency']
88
- assert_equal @testdata['push_output_params']['url'], subscription.output_params['url']
89
- assert_equal @testdata['push_output_params']['auth_type'], subscription.output_params['auth.type']
90
- assert_equal @testdata['push_output_params']['auth_username'], subscription.output_params['auth.username']
91
- assert_equal @testdata['push_output_params']['auth_password'], subscription.output_params['auth.password']
92
- assert_equal @testdata['push_last_request'], subscription.last_request
93
- assert_equal @testdata['push_last_success'], subscription.last_success
94
- end
95
- end
@@ -1,273 +0,0 @@
1
- require './' + File.dirname(__FILE__) + '/helper'
2
-
3
- class TestDefinition < Test::Unit::TestCase
4
- context "Given an empty Definition object" do
5
- setup do
6
- init()
7
- @definition = @user.createDefinition()
8
- end
9
-
10
- should "have an empty CSDL" do
11
- assert_not_nil @definition
12
- assert_equal '', @definition.csdl
13
- end
14
-
15
- should "correctly set and get the CSDL" do
16
- @definition.csdl = @testdata['definition']
17
- assert_equal @testdata['definition'], @definition.csdl
18
- end
19
- end
20
-
21
- context "Given a Definition object with CSDL" do
22
- setup do
23
- init()
24
- @definition = @user.createDefinition(@testdata['definition'])
25
- end
26
-
27
- should "have the correct CSDL" do
28
- assert_not_nil @definition
29
- assert_equal @testdata['definition'], @definition.csdl
30
- end
31
- end
32
-
33
- context "Given a Definition object with CSDL plus padding" do
34
- setup do
35
- init()
36
- @definition = @user.createDefinition(" " + @testdata['definition'] + " ")
37
- end
38
-
39
- should "have the correct CSDL" do
40
- assert_not_nil @definition
41
- assert_equal @testdata['definition'], @definition.csdl
42
- end
43
- end
44
-
45
- context "When trying to create a Definition object with an invalid user" do
46
- should "raise an InvalidDataError" do
47
- assert_raise(DataSift::InvalidDataError) { DataSift::Definition.new('username') }
48
- end
49
- end
50
-
51
- context "When trying to create a Definition object with an invalid CSDL" do
52
- setup do
53
- init()
54
- end
55
-
56
- should "raise an InvalidDataError" do
57
- assert_raise(DataSift::InvalidDataError) { DataSift::Definition.new(@user, 1234) }
58
- end
59
- end
60
-
61
- context "Given a Definition object with a valid CSDL" do
62
- setup do
63
- init()
64
- @definition = @user.createDefinition(@testdata['definition'])
65
- end
66
-
67
- should "compile the definition successfully" do
68
- begin
69
- @user.api_client.setResponse(200, {
70
- 'hash' => @testdata['definition_hash'],
71
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
72
- 'dpu' => 10,
73
- }, 200, 150)
74
- @definition.compile()
75
- rescue InvalidDataError
76
- assert false, "InvalidDataError"
77
- rescue CompileFailedError
78
- assert false, "CompileFailedError"
79
- rescue APIError
80
- assert false, "APIError"
81
- end
82
- end
83
-
84
- should "have the correct hash" do
85
- @user.api_client.setResponse(200, {
86
- 'hash' => @testdata['definition_hash'],
87
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
88
- 'dpu' => 10,
89
- }, 200, 150)
90
- assert_equal @testdata['definition_hash'], @definition.hash
91
- end
92
-
93
- should "have a positive DPU" do
94
- @user.api_client.setResponse(200, {
95
- 'hash' => @testdata['definition_hash'],
96
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
97
- 'dpu' => 10,
98
- }, 200, 150)
99
- @definition.compile()
100
- assert @definition.total_dpu > 0
101
- end
102
-
103
- should "have a valid created_at date" do
104
- @user.api_client.setResponse(200, {
105
- 'hash' => @testdata['definition_hash'],
106
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
107
- 'dpu' => 10,
108
- }, 200, 150)
109
- @definition.compile()
110
- assert @definition.created_at
111
- end
112
- end
113
-
114
- context "Given a Definition object with an invalid CSDL" do
115
- setup do
116
- init()
117
- @definition = @user.createDefinition(@testdata['invalid_definition'])
118
- end
119
-
120
- should "fail to compile the definition" do
121
- @user.api_client.setResponse(400, {
122
- 'error' => 'The target interactin.content does not exist',
123
- }, 200, 150)
124
- assert_raise(DataSift::CompileFailedError) { @definition.compile() }
125
- end
126
-
127
- should "fail to get the hash" do
128
- @user.api_client.setResponse(400, {
129
- 'error' => 'The target interactin.content does not exist',
130
- }, 200, 150)
131
- assert_raise(DataSift::CompileFailedError) { @definition.hash }
132
- end
133
- end
134
-
135
- context "The DPU returned from a valid Definition object" do
136
- setup do
137
- init()
138
- @definition = @user.createDefinition(@testdata['definition'])
139
- # Compile the definition first
140
- @user.api_client.setResponse(200, {
141
- 'hash' => @testdata['definition_hash'],
142
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
143
- 'dpu' => 10,
144
- }, 200, 150)
145
- @definition.compile()
146
- # Now get the DPU
147
- @user.api_client.setResponse(200, {
148
- 'detail' => {
149
- 'contains' => {
150
- 'count' => 1,
151
- 'dpu' => 4,
152
- 'targets' => {
153
- 'interaction.content' => {
154
- 'count' => 1,
155
- 'dpu' => 4,
156
- },
157
- },
158
- },
159
- },
160
- 'dpu' => 4
161
- }, 200, 150)
162
- @dpu = @definition.getDPUBreakdown()
163
- end
164
-
165
- should "contain valid DPU data" do
166
- assert @dpu.has_key?('detail')
167
- assert @dpu.has_key?('dpu')
168
- end
169
-
170
- should "have a positive total DPU" do
171
- assert @dpu['dpu'] > 0
172
- end
173
- end
174
-
175
- context "Buffered data returned by a valid Definition object" do
176
- setup do
177
- init()
178
- @definition = @user.createDefinition(@testdata['definition'])
179
- # Compile the definition first
180
- @user.api_client.setResponse(200, {
181
- 'hash' => @testdata['definition_hash'],
182
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
183
- 'dpu' => 10,
184
- }, 200, 150)
185
- @definition.compile()
186
- # Now get some buffered interactions
187
- @user.api_client.setResponse(200, {
188
- 'stream' => {
189
- 0 => {
190
- 'interaction' => {
191
- 'source' => 'Snaptu',
192
- 'author' => {
193
- 'username' => 'nittolexia',
194
- 'name' => 'nittosoetreznoe',
195
- 'id' => 172192091,
196
- 'avatar' => 'http://a0.twimg.com/profile_images/1429378181/gendowor_normal.jpg',
197
- 'link' => 'http://twitter.com/nittolexia',
198
- },
199
- 'type' => 'twitter',
200
- 'link' => 'http://twitter.com/nittolexia/statuses/89571192838684672',
201
- 'created_at' => 'Sat, 09 Jul 2011 05:46:51 +0000',
202
- 'content' => 'RT @ayyuchadel: Haha RT @nittolexia: Mending gak ush maen twitter dehh..RT @sansan_arie:',
203
- 'id' => '1e0a9eedc207acc0e074ea8aecb2c5ea',
204
- },
205
- 'twitter' => {
206
- 'user' => {
207
- 'name' => 'nittosoetreznoe',
208
- 'description' => 'fuck all',
209
- 'location' => 'denpasar, bali',
210
- 'statuses_count' => 6830,
211
- 'followers_count' => 88,
212
- 'friends_count' => 111,
213
- 'screen_name' => 'nittolexia',
214
- 'lang' => 'en',
215
- 'time_zone' => 'Alaska',
216
- 'id' => 172192091,
217
- 'geo_enabled' => true,
218
- },
219
- 'mentions' => {
220
- 0 => 'ayyuchadel',
221
- 1 => 'nittolexia',
222
- 2 => 'sansan_arie',
223
- },
224
- 'id' => '89571192838684672',
225
- 'text' => 'RT @ayyuchadel: Haha RT @nittolexia: Mending gak ush maen twitter dehh..RT @sansan_arie:',
226
- 'source' => '<a href="http://www.snaptu.com" rel="nofollow">Snaptu</a>',
227
- 'created_at' => 'Sat, 09 Jul 2011 05:46:51 +0000',
228
- },
229
- 'klout' => {
230
- 'score' => 45,
231
- 'network' => 55,
232
- 'amplification' => 17,
233
- 'true_reach' => 31,
234
- 'slope' => 0,
235
- 'class' => 'Networker',
236
- },
237
- 'peerindex' => {
238
- 'score' => 30,
239
- },
240
- 'language' => {
241
- 'tag' => 'da',
242
- },
243
- },
244
- },
245
- }, 200, 150)
246
- @interactions = @definition.getBuffered()
247
- end
248
-
249
- should "be valid" do
250
- assert @interactions
251
- end
252
- end
253
-
254
- context "A StreamConsumer object returned by a valid Definition object" do
255
- setup do
256
- init()
257
- @definition = @user.createDefinition(@testdata['definition'])
258
- # Compile the definition first
259
- @user.api_client.setResponse(200, {
260
- 'hash' => @testdata['definition_hash'],
261
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
262
- 'dpu' => 10,
263
- }, 200, 150)
264
- @definition.compile()
265
- # Now get a consumer
266
- @consumer = @definition.getConsumer()
267
- end
268
-
269
- should "be valid" do
270
- assert @consumer.is_a? DataSift::StreamConsumer
271
- end
272
- end
273
- end
@@ -1,233 +0,0 @@
1
- require './' + File.dirname(__FILE__) + '/helper'
2
-
3
- class TestHistorics < Test::Unit::TestCase
4
- context "Given a new Historic object from a stream hash" do
5
- setup do
6
- init()
7
- # Create the historic
8
- @historic = @user.createHistoric(@testdata['definition_hash'], @testdata['historic_start'], @testdata['historic_end'], @testdata['historic_sources'], @testdata['historic_sample'], @testdata['historic_name'])
9
- end
10
-
11
- should "be a Historic object" do
12
- assert_not_nil @historic
13
- assert @historic.kind_of?(DataSift::Historic)
14
- end
15
-
16
- should "have the correct definition_hash" do
17
- assert_equal @testdata['definition_hash'], @historic.stream_hash
18
- end
19
-
20
- should "have the correct name" do
21
- assert_equal @testdata['historic_name'], @historic.name
22
- end
23
-
24
- should "have the correct start_date" do
25
- assert_equal @testdata['historic_start'], @historic.start_date
26
- end
27
-
28
- should "have the correct end_date" do
29
- assert_equal @testdata['historic_end'], @historic.end_date
30
- end
31
-
32
- should "have the correct status" do
33
- assert_equal @testdata['historic_status'], @historic.status
34
- end
35
-
36
- should "have the correct progress" do
37
- assert_equal 0, @historic.progress
38
- end
39
-
40
- should "have the correct sample" do
41
- assert_equal @testdata['historic_sample'], @historic.sample
42
- end
43
-
44
- should "be able to change the name before preparing" do
45
- assert_equal @testdata['historic_name'], @historic.name
46
-
47
- @historic.name = 'new name'
48
-
49
- assert_equal 'new name', @historic.name
50
- end
51
-
52
- should "be able to prepare the query" do
53
- setResponseToASingleHistoric({
54
- 'dpus' => @testdata['historic_dpus'],
55
- 'availability' => @testdata['historic_availability']
56
- })
57
- @historic.prepare()
58
- end
59
-
60
- should "not be able to prepare it more than once" do
61
- setResponseToASingleHistoric({
62
- 'dpus' => @testdata['historic_dpus'],
63
- 'availability' => @testdata['historic_availability']
64
- })
65
- @historic.prepare()
66
- assert_raise(DataSift::InvalidDataError) { @historic.prepare() }
67
- end
68
-
69
- should "be able to change the name after preparing" do
70
- setResponseToASingleHistoric({
71
- 'dpus' => @testdata['historic_dpus'],
72
- 'availability' => @testdata['historic_availability']
73
- })
74
- @historic.prepare()
75
-
76
- assert_equal @testdata['historic_name'], @historic.name
77
-
78
- new_name = 'new name'
79
- setResponseToASingleHistoric({ 'name' => new_name })
80
- @historic.name = new_name
81
-
82
- assert_equal new_name, @historic.name
83
- end
84
-
85
- should "be able to start the query" do
86
- setResponseToASingleHistoric({
87
- 'dpus' => @testdata['historic_dpus'],
88
- 'availability' => @testdata['historic_availability']
89
- })
90
- @historic.prepare()
91
-
92
- set204Response()
93
- @historic.start()
94
- end
95
-
96
- should "be able to stop the query" do
97
- setResponseToASingleHistoric({
98
- 'dpus' => @testdata['historic_dpus'],
99
- 'availability' => @testdata['historic_availability']
100
- })
101
- @historic.prepare()
102
-
103
- set204Response()
104
- @historic.stop()
105
- end
106
-
107
- should "be able to delete the query" do
108
- setResponseToASingleHistoric({
109
- 'dpus' => @testdata['historic_dpus'],
110
- 'availability' => @testdata['historic_availability']
111
- })
112
- @historic.prepare()
113
-
114
- set204Response()
115
- @historic.delete()
116
- end
117
-
118
- should "not be able to start the query after deletion" do
119
- setResponseToASingleHistoric({
120
- 'dpus' => @testdata['historic_dpus'],
121
- 'availability' => @testdata['historic_availability']
122
- })
123
- @historic.prepare()
124
-
125
- set204Response()
126
- @historic.delete()
127
-
128
- assert_raise(DataSift::InvalidDataError) { @historic.start() }
129
- end
130
- end
131
-
132
- context "Given a new Historic object from a Definition" do
133
- setup do
134
- init()
135
- # Create the definition
136
- @definition = @user.createDefinition(@testdata['definition'])
137
- # Create the historic (API response is for compiling the definition)
138
- @user.api_client.setResponse(200, {
139
- 'hash' => @testdata['definition_hash'],
140
- 'created_at' => Time.now.strftime('%Y-%m-%d %H:%M:%S'),
141
- 'dpu' => 10,
142
- }, 200, 150)
143
- @historic = @definition.createHistoric(@testdata['historic_start'], @testdata['historic_end'], @testdata['historic_sources'], @testdata['historic_sample'], @testdata['historic_name'])
144
- end
145
-
146
- should "be a Historic object" do
147
- assert_not_nil @historic
148
- end
149
-
150
- should "have the correct definition_hash" do
151
- assert_equal @testdata['definition_hash'], @historic.stream_hash
152
- end
153
-
154
- should "have the correct name" do
155
- assert_equal @testdata['historic_name'], @historic.name
156
- end
157
-
158
- should "have the correct start_date" do
159
- assert_equal @testdata['historic_start'], @historic.start_date
160
- end
161
-
162
- should "have the correct end_date" do
163
- assert_equal @testdata['historic_end'], @historic.end_date
164
- end
165
-
166
- should "have the correct status" do
167
- assert_equal @testdata['historic_status'], @historic.status
168
- end
169
-
170
- should "have the correct progress" do
171
- assert_equal 0, @historic.progress
172
- end
173
-
174
- should "have the correct sample" do
175
- assert_equal @testdata['historic_sample'], @historic.sample
176
- end
177
- end
178
-
179
- context "Given a Historic object retrieved from the API" do
180
- setup do
181
- init()
182
- # Create the historic (API response is for compiling the definition)
183
- setResponseToASingleHistoric()
184
- @historic = @user.getHistoric(@testdata['historic_playback_id'])
185
- end
186
-
187
- should "be a Historic object" do
188
- assert_not_nil @historic
189
- end
190
-
191
- should "have the correct definition_hash" do
192
- assert_equal @testdata['definition_hash'], @historic.stream_hash
193
- end
194
-
195
- should "have the correct name" do
196
- assert_equal @testdata['historic_name'], @historic.name
197
- end
198
-
199
- should "have the correct start_date" do
200
- assert_equal @testdata['historic_start'], @historic.start_date
201
- end
202
-
203
- should "have the correct end_date" do
204
- assert_equal @testdata['historic_end'], @historic.end_date
205
- end
206
-
207
- should "have the correct status" do
208
- assert_equal @testdata['historic_status'], @historic.status
209
- end
210
-
211
- should "have the correct progress" do
212
- assert_equal 0, @historic.progress
213
- end
214
-
215
- should "have the correct sample" do
216
- assert_equal @testdata['historic_sample'], @historic.sample
217
- end
218
-
219
- should "not be able to prepare the query" do
220
- assert_raise(DataSift::InvalidDataError) { @historic.prepare() }
221
- end
222
-
223
- should "be able to change the name" do
224
- assert_equal @testdata['historic_name'], @historic.name
225
-
226
- new_name = 'new name'
227
- setResponseToASingleHistoric({ 'name' => new_name })
228
- @historic.name = new_name
229
-
230
- assert_equal new_name, @historic.name
231
- end
232
- end
233
- end