mrt-ingest 0.0.4 → 0.0.5
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.
- checksums.yaml +5 -5
- data/.gitignore +5 -1
- data/.idea/.rakeTasks +7 -0
- data/.idea/encodings.xml +4 -0
- data/.idea/inspectionProfiles/Project_Default.xml +18 -0
- data/.idea/misc.xml +32 -0
- data/.idea/modules.xml +8 -0
- data/.idea/vcs.xml +6 -0
- data/.rubocop.yml +87 -0
- data/.ruby-version +2 -0
- data/CHANGES.md +25 -0
- data/Gemfile +1 -4
- data/README.md +56 -0
- data/Rakefile +36 -17
- data/lib/mrt/ingest.rb +1 -16
- data/lib/mrt/ingest/client.rb +11 -10
- data/lib/mrt/ingest/component.rb +78 -0
- data/lib/mrt/ingest/ingest_exception.rb +6 -0
- data/lib/mrt/ingest/iobject.rb +36 -93
- data/lib/mrt/ingest/message_digest.rb +8 -10
- data/lib/mrt/ingest/one_time_server.rb +34 -44
- data/lib/mrt/ingest/request.rb +67 -41
- data/lib/mrt/ingest/response.rb +6 -6
- data/mrt-ingest-ruby.iml +65 -0
- data/mrt-ingest.gemspec +22 -20
- data/spec/.rubocop.yml +16 -0
- data/spec/spec_helper.rb +36 -0
- data/spec/unit/data/file.txt +1 -0
- data/spec/unit/mrt/ingest/client_spec.rb +31 -0
- data/spec/unit/mrt/ingest/component_spec.rb +12 -0
- data/spec/unit/mrt/ingest/iobject_spec.rb +248 -0
- data/spec/unit/mrt/ingest/message_digest_spec.rb +38 -0
- data/spec/unit/mrt/ingest/one_time_server_spec.rb +113 -0
- data/spec/unit/mrt/ingest/request_spec.rb +25 -0
- data/spec/unit/mrt/ingest/response_spec.rb +56 -0
- metadata +95 -15
- data/README +0 -29
- data/test/test_client.rb +0 -40
- data/test/test_iobject.rb +0 -174
- data/test/test_request.rb +0 -37
- data/test/test_response.rb +0 -63
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Mrt::Ingest
|
4
|
+
module MessageDigest
|
5
|
+
describe SHA256 do
|
6
|
+
it 'wraps an SHA256 digest' do
|
7
|
+
value = '40191d95b873db0b6ac09aca3cf51188ce914920a2330ddda1d88f75d93588e6'
|
8
|
+
digest = SHA256.new(value)
|
9
|
+
expect(digest.value).to eq(value)
|
10
|
+
expect(digest.type).to eq('sha-256')
|
11
|
+
end
|
12
|
+
end
|
13
|
+
describe MD5 do
|
14
|
+
it 'wraps an MD5 digest' do
|
15
|
+
value = 'b6d8a343fe281e92f1296283c29efc72'
|
16
|
+
digest = MD5.new(value)
|
17
|
+
expect(digest.value).to eq(value)
|
18
|
+
expect(digest.type).to eq('md5')
|
19
|
+
end
|
20
|
+
|
21
|
+
describe :from_file do
|
22
|
+
it 'hashes a file in text mode' do
|
23
|
+
digest = MD5.from_file(File.new('spec/unit/data/file.txt'))
|
24
|
+
expect(digest.value).to eq('91b767c2da0e8bfe318aee57d907d5f7')
|
25
|
+
expect(digest.type).to eq('md5')
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
describe SHA1 do
|
30
|
+
it 'wraps an SHA1 digest' do
|
31
|
+
value = '08eefa1ab77c34a479310632923771f835c475e3'
|
32
|
+
digest = SHA1.new(value)
|
33
|
+
expect(digest.value).to eq(value)
|
34
|
+
expect(digest.type).to eq('sha1')
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,113 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'English'
|
3
|
+
|
4
|
+
module Mrt::Ingest
|
5
|
+
describe OneTimeServer do
|
6
|
+
attr_reader :server
|
7
|
+
|
8
|
+
before(:each) do
|
9
|
+
@server = OneTimeServer.new
|
10
|
+
server.start_server
|
11
|
+
end
|
12
|
+
|
13
|
+
after(:each) do
|
14
|
+
server.stop_server
|
15
|
+
end
|
16
|
+
|
17
|
+
describe :finished? do
|
18
|
+
it 'returns true when all files have been served, false otherwise' do
|
19
|
+
urls = (0..3).map do |i|
|
20
|
+
url_str, = server.add_file { |f| f.puts("I am file #{i}") }
|
21
|
+
url_str
|
22
|
+
end
|
23
|
+
|
24
|
+
urls.each do |url|
|
25
|
+
expect(server.finished?).to be_falsey
|
26
|
+
Net::HTTP.get(URI.parse(url))
|
27
|
+
end
|
28
|
+
|
29
|
+
expect(server.finished?).to be_truthy
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
describe :temppath do
|
34
|
+
it 'avoids collisions' do
|
35
|
+
tmpfiles = []
|
36
|
+
allow(Tempfile).to receive(:new).and_wrap_original do |m, *args|
|
37
|
+
tmpfile = m.call(*args)
|
38
|
+
if tmpfiles.empty?
|
39
|
+
known_paths = server.instance_variable_get(:@known_paths)
|
40
|
+
known_paths[tmpfile.path] = true
|
41
|
+
end
|
42
|
+
tmpfiles << tmpfile.path
|
43
|
+
tmpfile
|
44
|
+
end
|
45
|
+
|
46
|
+
temppath = server.temppath
|
47
|
+
expect(tmpfiles.size).to eq(2)
|
48
|
+
expect(temppath).to eq(tmpfiles[1])
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
describe :join_server do
|
53
|
+
it 'blocks till all files have been served' do
|
54
|
+
urls = (0..3).map do |i|
|
55
|
+
url_str, = server.add_file { |f| f.puts("I am file #{i}") }
|
56
|
+
url_str
|
57
|
+
end
|
58
|
+
|
59
|
+
joining_thread = Thread.new { server.join_server }
|
60
|
+
expect(joining_thread.status).not_to be_falsey
|
61
|
+
|
62
|
+
client_process_id = fork do
|
63
|
+
begin
|
64
|
+
urls.each do |url|
|
65
|
+
resp = Net::HTTP.get_response(URI.parse(url))
|
66
|
+
status = resp.code.to_i
|
67
|
+
exit(status) if status != 200
|
68
|
+
end
|
69
|
+
rescue StandardError => e
|
70
|
+
warn(e)
|
71
|
+
exit(1)
|
72
|
+
end
|
73
|
+
end
|
74
|
+
Process.wait(client_process_id)
|
75
|
+
expect($CHILD_STATUS.exitstatus).to eq(0) # just to be sure
|
76
|
+
|
77
|
+
Timeout.timeout(5) { joining_thread.join }
|
78
|
+
expect(joining_thread.status).to eq(false)
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
describe :run do
|
83
|
+
it 'starts, serves, and stops' do
|
84
|
+
server2 = OneTimeServer.new
|
85
|
+
urls = (0..3).map do |i|
|
86
|
+
url_str, = server2.add_file { |f| f.puts("I am file #{i}") }
|
87
|
+
url_str
|
88
|
+
end
|
89
|
+
|
90
|
+
running_thread = Thread.new { server2.run }
|
91
|
+
expect(running_thread.status).not_to be_falsey
|
92
|
+
|
93
|
+
client_process_id = fork do
|
94
|
+
begin
|
95
|
+
urls.each do |url|
|
96
|
+
resp = Net::HTTP.get_response(URI.parse(url))
|
97
|
+
status = resp.code.to_i
|
98
|
+
exit(status) if status != 200
|
99
|
+
end
|
100
|
+
rescue StandardError => e
|
101
|
+
warn(e)
|
102
|
+
exit(1)
|
103
|
+
end
|
104
|
+
end
|
105
|
+
Process.wait(client_process_id)
|
106
|
+
expect($CHILD_STATUS.exitstatus).to eq(0) # just to be sure
|
107
|
+
|
108
|
+
Timeout.timeout(5) { running_thread.join }
|
109
|
+
expect(running_thread.status).to eq(false)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Mrt::Ingest
|
4
|
+
describe Request do
|
5
|
+
describe :new do
|
6
|
+
it 'should require a profile' do
|
7
|
+
expect do
|
8
|
+
Mrt::Ingest::Request.new(profile: nil, submitter: 'jd/John Doe', type: 'file')
|
9
|
+
end.to raise_error(ArgumentError)
|
10
|
+
end
|
11
|
+
|
12
|
+
it 'should require a submitter' do
|
13
|
+
expect do
|
14
|
+
Mrt::Ingest::Request.new(profile: 'demo_merritt', submitter: nil, type: 'file')
|
15
|
+
end.to raise_error(ArgumentError)
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'should require a type' do
|
19
|
+
expect do
|
20
|
+
Mrt::Ingest::Request.new(profile: 'demo_merritt', submitter: 'jd/John Doe', type: nil)
|
21
|
+
end.to raise_error(ArgumentError)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Mrt::Ingest
|
4
|
+
describe Response do
|
5
|
+
RESPONSE_JSON = <<~JSON.freeze
|
6
|
+
{
|
7
|
+
"bat:batchState": {
|
8
|
+
"bat:batchID":"bid-8c0fa0c2-f3d7-4deb-bd49-f953f6752b59",
|
9
|
+
"bat:updateFlag":false,
|
10
|
+
"bat:targetQueue":"example.org:2181",
|
11
|
+
"bat:batchStatus":"QUEUED",
|
12
|
+
"bat:userAgent":"egh/Erik Hetzner",
|
13
|
+
"bat:submissionDate":"2011-08-31T15:40:26-07:00",
|
14
|
+
"bat:targetQueueNode":"/ingest.example.1",
|
15
|
+
"bat:batchProfile": {
|
16
|
+
"bat:owner":"ark:/99999/fk4tt4wsh",
|
17
|
+
"bat:creationDate":"2010-01-19T13:28:14-08:00",
|
18
|
+
"bat:targetStorage": {
|
19
|
+
"bat:storageLink":"http://example.org:35121",
|
20
|
+
"bat:nodeID":10
|
21
|
+
},
|
22
|
+
"bat:objectType":"MRT-curatorial",
|
23
|
+
"bat:modificationDate":"2010-01-26T23:28:14-08:00",
|
24
|
+
"bat:aggregateType":"",
|
25
|
+
"bat:objectMinterURL":"https://example.org/ezid/shoulder/ark:/99999/fk4",
|
26
|
+
"bat:collection": {
|
27
|
+
},
|
28
|
+
"bat:profileID":"merritt_content",
|
29
|
+
"bat:profileDescription":"Merritt demo content",
|
30
|
+
"bat:fixityURL":"http://example.org:33143",
|
31
|
+
"bat:contactsEmail": {
|
32
|
+
"bat:notification": {
|
33
|
+
"bat:contactEmail":"erik.hetzner@example.org"
|
34
|
+
}
|
35
|
+
},
|
36
|
+
"bat:identifierScheme":"ARK",
|
37
|
+
"bat:identifierNamespace":"99999",
|
38
|
+
"bat:objectRole":"MRT-content"
|
39
|
+
}
|
40
|
+
}
|
41
|
+
}
|
42
|
+
JSON
|
43
|
+
|
44
|
+
describe :new do
|
45
|
+
before(:each) do
|
46
|
+
@response = Response.new(RESPONSE_JSON)
|
47
|
+
end
|
48
|
+
|
49
|
+
it 'should parse the response' do
|
50
|
+
expect(@response.batch_id).to eq('bid-8c0fa0c2-f3d7-4deb-bd49-f953f6752b59')
|
51
|
+
expect(@response.submission_date).to eq(Time.at(1_314_830_426))
|
52
|
+
expect(@response.user_agent).to eq('egh/Erik Hetzner')
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mrt-ingest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mark Reyes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: json
|
@@ -95,6 +95,34 @@ dependencies:
|
|
95
95
|
- - "~>"
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '12.0'
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: rspec
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - "~>"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '3.8'
|
105
|
+
type: :development
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - "~>"
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '3.8'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: rubocop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - "~>"
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0.68'
|
119
|
+
type: :development
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - "~>"
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0.68'
|
98
126
|
- !ruby/object:Gem::Dependency
|
99
127
|
name: shoulda
|
100
128
|
requirement: !ruby/object:Gem::Requirement
|
@@ -110,19 +138,47 @@ dependencies:
|
|
110
138
|
- !ruby/object:Gem::Version
|
111
139
|
version: '3.6'
|
112
140
|
- !ruby/object:Gem::Dependency
|
113
|
-
name:
|
141
|
+
name: simplecov
|
142
|
+
requirement: !ruby/object:Gem::Requirement
|
143
|
+
requirements:
|
144
|
+
- - "~>"
|
145
|
+
- !ruby/object:Gem::Version
|
146
|
+
version: '0.16'
|
147
|
+
type: :development
|
148
|
+
prerelease: false
|
149
|
+
version_requirements: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - "~>"
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0.16'
|
154
|
+
- !ruby/object:Gem::Dependency
|
155
|
+
name: simplecov-console
|
156
|
+
requirement: !ruby/object:Gem::Requirement
|
157
|
+
requirements:
|
158
|
+
- - "~>"
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0.4'
|
161
|
+
type: :development
|
162
|
+
prerelease: false
|
163
|
+
version_requirements: !ruby/object:Gem::Requirement
|
164
|
+
requirements:
|
165
|
+
- - "~>"
|
166
|
+
- !ruby/object:Gem::Version
|
167
|
+
version: '0.4'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: webmock
|
114
170
|
requirement: !ruby/object:Gem::Requirement
|
115
171
|
requirements:
|
116
172
|
- - "~>"
|
117
173
|
- !ruby/object:Gem::Version
|
118
|
-
version: '3.
|
174
|
+
version: '3.5'
|
119
175
|
type: :development
|
120
176
|
prerelease: false
|
121
177
|
version_requirements: !ruby/object:Gem::Requirement
|
122
178
|
requirements:
|
123
179
|
- - "~>"
|
124
180
|
- !ruby/object:Gem::Version
|
125
|
-
version: '3.
|
181
|
+
version: '3.5'
|
126
182
|
description: A client for the Merritt ingest system. More details available from https://github.com/CDLUC3/mrt-doc/wiki
|
127
183
|
email:
|
128
184
|
- mark.reyes@ucop.edu
|
@@ -133,23 +189,41 @@ extra_rdoc_files: []
|
|
133
189
|
files:
|
134
190
|
- ".gitignore"
|
135
191
|
- ".hgignore"
|
192
|
+
- ".idea/.rakeTasks"
|
193
|
+
- ".idea/encodings.xml"
|
194
|
+
- ".idea/inspectionProfiles/Project_Default.xml"
|
195
|
+
- ".idea/misc.xml"
|
196
|
+
- ".idea/modules.xml"
|
197
|
+
- ".idea/vcs.xml"
|
198
|
+
- ".rubocop.yml"
|
199
|
+
- ".ruby-version"
|
136
200
|
- ".travis.yml"
|
201
|
+
- CHANGES.md
|
137
202
|
- Gemfile
|
138
203
|
- LICENSE
|
139
|
-
- README
|
204
|
+
- README.md
|
140
205
|
- Rakefile
|
141
206
|
- lib/mrt/ingest.rb
|
142
207
|
- lib/mrt/ingest/client.rb
|
208
|
+
- lib/mrt/ingest/component.rb
|
209
|
+
- lib/mrt/ingest/ingest_exception.rb
|
143
210
|
- lib/mrt/ingest/iobject.rb
|
144
211
|
- lib/mrt/ingest/message_digest.rb
|
145
212
|
- lib/mrt/ingest/one_time_server.rb
|
146
213
|
- lib/mrt/ingest/request.rb
|
147
214
|
- lib/mrt/ingest/response.rb
|
215
|
+
- mrt-ingest-ruby.iml
|
148
216
|
- mrt-ingest.gemspec
|
149
|
-
-
|
150
|
-
-
|
151
|
-
-
|
152
|
-
-
|
217
|
+
- spec/.rubocop.yml
|
218
|
+
- spec/spec_helper.rb
|
219
|
+
- spec/unit/data/file.txt
|
220
|
+
- spec/unit/mrt/ingest/client_spec.rb
|
221
|
+
- spec/unit/mrt/ingest/component_spec.rb
|
222
|
+
- spec/unit/mrt/ingest/iobject_spec.rb
|
223
|
+
- spec/unit/mrt/ingest/message_digest_spec.rb
|
224
|
+
- spec/unit/mrt/ingest/one_time_server_spec.rb
|
225
|
+
- spec/unit/mrt/ingest/request_spec.rb
|
226
|
+
- spec/unit/mrt/ingest/response_spec.rb
|
153
227
|
homepage: https://github.com/CDLUC3/mrt-ingest-ruby
|
154
228
|
licenses:
|
155
229
|
- BSD-3-Clause
|
@@ -170,12 +244,18 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
244
|
version: '0'
|
171
245
|
requirements: []
|
172
246
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
247
|
+
rubygems_version: 2.6.14.1
|
174
248
|
signing_key:
|
175
249
|
specification_version: 4
|
176
250
|
summary: A client for Merritt ingest.
|
177
251
|
test_files:
|
178
|
-
-
|
179
|
-
-
|
180
|
-
-
|
181
|
-
-
|
252
|
+
- spec/.rubocop.yml
|
253
|
+
- spec/spec_helper.rb
|
254
|
+
- spec/unit/data/file.txt
|
255
|
+
- spec/unit/mrt/ingest/client_spec.rb
|
256
|
+
- spec/unit/mrt/ingest/component_spec.rb
|
257
|
+
- spec/unit/mrt/ingest/iobject_spec.rb
|
258
|
+
- spec/unit/mrt/ingest/message_digest_spec.rb
|
259
|
+
- spec/unit/mrt/ingest/one_time_server_spec.rb
|
260
|
+
- spec/unit/mrt/ingest/request_spec.rb
|
261
|
+
- spec/unit/mrt/ingest/response_spec.rb
|
data/README
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
= mrt-ingest (ruby)
|
2
|
-
Date:: 6 Sept. 2011
|
3
|
-
Author:: Erik Hetzner (mailto:erik.hetzner@ucop.edu)
|
4
|
-
|
5
|
-
== What?
|
6
|
-
|
7
|
-
A Ruby ingest client for Merritt[http://merritt.cdlib.org/].
|
8
|
-
|
9
|
-
== Install
|
10
|
-
|
11
|
-
$ gem build mrt-ingest.gemspec
|
12
|
-
$ sudo gem install mrt-ingest-0.0.1.gem
|
13
|
-
|
14
|
-
== How?
|
15
|
-
|
16
|
-
require 'rubygems'
|
17
|
-
require 'mrt/ingest'
|
18
|
-
client = Mrt::Ingest::Client.new("http://merritt.cdlib.org/object/ingest", USERNAME, PASSWORD)
|
19
|
-
obj = Mrt::Ingest::IObject.new(:erc => {
|
20
|
-
"who" => "Doe, John",
|
21
|
-
"what" => "Hello, world",
|
22
|
-
"when/created" => "2011" })
|
23
|
-
obj.add_component(File.new("/tmp/helloworld_a"))
|
24
|
-
obj.add_component(File.new("/tmp/helloworld_b"))
|
25
|
-
obj.add_component(URI.parse("http://example.org/xxx"),
|
26
|
-
:name => "helloworld_c",
|
27
|
-
:digest => Mrt::Ingest::MessageDigest::MD5.new("6f5902ac237024bdd0c176cb93063dc4"))
|
28
|
-
obj.start_ingest(client, "demo_merritt_content", "me/My Name")
|
29
|
-
obj.finish_ingest()
|
data/test/test_client.rb
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
# Author:: Erik Hetzner (mailto:erik.hetzner@ucop.edu)
|
2
|
-
# Copyright:: Copyright (c) 2011, Regents of the University of California
|
3
|
-
|
4
|
-
require 'rubygems'
|
5
|
-
|
6
|
-
require 'test/unit'
|
7
|
-
require 'checkm'
|
8
|
-
require 'fakeweb'
|
9
|
-
require 'mocha'
|
10
|
-
require 'mrt/ingest'
|
11
|
-
require 'shoulda'
|
12
|
-
require 'open-uri'
|
13
|
-
|
14
|
-
class TestClient < Test::Unit::TestCase
|
15
|
-
context "creating a client" do
|
16
|
-
should "be able to create an ingest client" do
|
17
|
-
client = Mrt::Ingest::Client.new("http://example.org/ingest")
|
18
|
-
assert_instance_of(Mrt::Ingest::Client, client)
|
19
|
-
end
|
20
|
-
|
21
|
-
should "be able to create an ingest client with login credentials" do
|
22
|
-
client = Mrt::Ingest::Client.new("http://example.org/ingest", "me", "secret")
|
23
|
-
assert_instance_of(Mrt::Ingest::Client, client)
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
context "ingest clients" do
|
28
|
-
setup do
|
29
|
-
@client = Mrt::Ingest::Client.new("http://example.org/ingest", "me", "secret")
|
30
|
-
@iobject = Mrt::Ingest::IObject.new
|
31
|
-
@ingest_req = @iobject.mk_request("profile", "submitter")
|
32
|
-
end
|
33
|
-
|
34
|
-
should "should create a good rest client request" do
|
35
|
-
rest_req = @client.mk_rest_request(@ingest_req)
|
36
|
-
assert_equal("me", rest_req.user)
|
37
|
-
assert_equal("secret", rest_req.password)
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|