docusigner 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,11 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'docusigner'
4
+ require 'shoulda'
5
+ require 'webmock/test_unit'
6
+
7
+ class Test::Unit::TestCase
8
+ include WebMock::API
9
+ end
10
+
11
+ WebMock.disable_net_connect!
@@ -0,0 +1,405 @@
1
+ require 'test_helper'
2
+
3
+ class Docusigner::AccountTest < Test::Unit::TestCase
4
+
5
+ context "an account" do
6
+ setup do
7
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf.json")
8
+ .to_return(:body => {
9
+ "accountIdGuid" => "1234-asdf",
10
+ "accountName" => "My Account Name",
11
+ "billingPeriodEndDate" => "2013-03-21T07:00:00.0000000Z",
12
+ "billingPeriodEnvelopesAllowed" => "",
13
+ "billingPeriodEnvelopesSent" => "",
14
+ "billingPeriodStartDate" => "2013-02-21T08:00:00.0000000Z",
15
+ "connectPermission" => "full",
16
+ "currencyCode" => "USD",
17
+ "currentPlanId" => "36eb5ca8-ebc0-446b-930c-ee010eb59179",
18
+ "distributorCode" => "DocuSign",
19
+ "docuSignLandingUrl" => "http://www.docusign.com/products/sign_up/buy_now.php",
20
+ "planName" => "DocuSign Demo Plan",
21
+ "planStartDate" => "2013-02-21T14:28:35.0000000Z",
22
+ "suspensionStatus" => ""
23
+ }.to_json)
24
+ @account = Docusigner::Account.find("1234-asdf")
25
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf.json")
26
+ end
27
+
28
+ should "be findable by id" do
29
+ assert_equal("1234-asdf", @account.id)
30
+ end
31
+
32
+ should "be able to fetch its brands" do
33
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/brands.json")
34
+ .to_return(:body => {
35
+ "brands" => [{
36
+ "brandCompany" => "String content",
37
+ "brandId" => "1",
38
+ "brandName" => "String content",
39
+ }, {
40
+ "brandCompany" => "String content",
41
+ "brandId" => "2",
42
+ "brandName" => "String content",
43
+ }],
44
+ "recipientBrandIdDefault" => "1",
45
+ "senderBrandIdDefault" => "1",
46
+ }.to_json)
47
+ brands = @account.brands
48
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/brands.json")
49
+ assert_equal(2, brands.length)
50
+ brands.each do |brand|
51
+ assert_equal("1234-asdf", brand.account_id)
52
+ end
53
+ end
54
+
55
+ should "be able to fetch a list of custom fields" do
56
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/custom_fields.json")
57
+ .to_return(:body => {
58
+ "listCustomFields" => [{
59
+ "name" => "String",
60
+ "required" => "String",
61
+ "show" => "String",
62
+ "listItems" => ["String","String"]
63
+ },
64
+ {
65
+ "name" => "String",
66
+ "required" => "String",
67
+ "show" => "String",
68
+ "listItems" => ["String","String"]
69
+ }],
70
+ "textCustomFields" => [{
71
+ "name" => "String",
72
+ "required" => "String",
73
+ "show" => "String",
74
+ },
75
+ {
76
+ "name" => "String",
77
+ "required" => "String",
78
+ "show" => "String",
79
+ }]
80
+ }.to_json)
81
+ custom_fields = @account.custom_fields
82
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/custom_fields.json")
83
+ assert_equal(4, custom_fields.length)
84
+ custom_fields.each do |custom_field|
85
+ assert_equal("1234-asdf", custom_field.account_id)
86
+ end
87
+ end
88
+
89
+ should "be able to fetch envelopes from a given date" do
90
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes.json?from_date=2013-01-01")
91
+ .to_return(:body => {
92
+ "envelopes" => [{
93
+ "certificateUri" => "String content",
94
+ "customFieldsUri" => "String content",
95
+ "documentsCombinedUri" => "String content",
96
+ "documentsUri" => "String content",
97
+ "envelopeId" => "envelope1",
98
+ "envelopeUri" => "String content",
99
+ "notificationUri" => "String content",
100
+ "recipientsUri" => "String content",
101
+ "status" => "created",
102
+ "statusChangedDateTime" => "String content"
103
+ },
104
+ {
105
+ "certificateUri" => "String content",
106
+ "customFieldsUri" => "String content",
107
+ "documentsCombinedUri" => "String content",
108
+ "documentsUri" => "String content",
109
+ "envelopeId" => "envelope2",
110
+ "envelopeUri" => "String content",
111
+ "notificationUri" => "String content",
112
+ "recipientsUri" => "String content",
113
+ "status" => "sent",
114
+ "statusChangedDateTime" => "String content"
115
+ }],
116
+ "resultSetSize" => "String content"
117
+ }.to_json)
118
+ envelopes = @account.envelopes("2013-01-01")
119
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes.json?from_date=2013-01-01")
120
+ assert_equal(2, envelopes.length)
121
+ envelopes.each do |envelope|
122
+ assert_equal("1234-asdf", envelope.account_id)
123
+ end
124
+ end
125
+
126
+ should "be able to fetch folders" do
127
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/folders.json")
128
+ .to_return(:body => {
129
+ "folders" => [{
130
+ "folderId" => "String content",
131
+ "name" => "String content",
132
+ "ownerEmail" => "String content",
133
+ "ownerUserName" => "String content",
134
+ "type" => "String content",
135
+ "uri" => "String content"
136
+ },
137
+ {
138
+ "folderId" => "String content",
139
+ "name" => "String content",
140
+ "ownerEmail" => "String content",
141
+ "ownerUserName" => "String content",
142
+ "type" => "String content",
143
+ "uri" => "String content"
144
+ },
145
+ {
146
+ "folderId" => "String content",
147
+ "folders" => [{
148
+ "folderId" => "String content",
149
+ "name" => "String content",
150
+ "ownerEmail" => "String content",
151
+ "ownerUserName" => "String content",
152
+ "parentFolderId" => "String content",
153
+ "parentFolderUri" => "String content",
154
+ "type" => "String content",
155
+ "uri" => "String content"
156
+ }],
157
+ }],
158
+ }.to_json)
159
+ folders = @account.folders
160
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/folders.json")
161
+ assert_equal(3, folders.length)
162
+ folders.each do |folder|
163
+ assert_equal("1234-asdf", folder.account_id)
164
+ end
165
+ end
166
+
167
+ should "be able to fetch groups" do
168
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/groups.json")
169
+ .to_return(:body => {
170
+ "groups" => [{
171
+ "groupId" => "String content",
172
+ "groupName" => "String content",
173
+ "groupType" => "String content",
174
+ "permissionsProfileId" => "String content"
175
+ }]
176
+ }.to_json)
177
+ groups = @account.groups
178
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/groups.json")
179
+ assert_equal(1, groups.length)
180
+ groups.each do |group|
181
+ assert_equal("1234-asdf", group.account_id)
182
+ end
183
+ end
184
+
185
+ should "be able to fetch settings" do
186
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/settings.json")
187
+ .to_return(:body => {
188
+ "accountSettings" => [
189
+ {
190
+ "name" => "allowInPerson",
191
+ "value" => "true"
192
+ },
193
+ {
194
+ "name" => "allowSignerReassign",
195
+ "value" => "true"
196
+ },
197
+ {
198
+ "name" => "attachCompletedEnvelope",
199
+ "value" => "true"
200
+ },
201
+ {
202
+ "name" => "autoNavRule",
203
+ "value" => "required_fields"
204
+ },
205
+ {
206
+ "name" => "canSelfBrandSend",
207
+ "value" => "true"
208
+ },
209
+ {
210
+ "name" => "canSelfBrandSign",
211
+ "value" => "true"
212
+ },
213
+ {
214
+ "name" => "enableAutoNav",
215
+ "value" => "false"
216
+ },
217
+ {
218
+ "name" => "enableCalculatedFields",
219
+ "value" => "true"
220
+ },
221
+ {
222
+ "name" => "enableDSPro",
223
+ "value" => "false"
224
+ },
225
+ {
226
+ "name" => "enableEnvelopeStampingByAccountAdmin",
227
+ "value" => "false"
228
+ },
229
+ {
230
+ "name" => "enablePaymentProcessing",
231
+ "value" => "false"
232
+ },
233
+ {
234
+ "name" => "enablePowerForm",
235
+ "value" => "true"
236
+ },
237
+ {
238
+ "name" => "enableReservedDomain",
239
+ "value" => "false"
240
+ },
241
+ {
242
+ "name" => "enableSendToAgent",
243
+ "value" => "true"
244
+ },
245
+ {
246
+ "name" => "enableSendToIntermediary",
247
+ "value" => "false"
248
+ },
249
+ {
250
+ "name" => "enableSendToManage",
251
+ "value" => "true"
252
+ },
253
+ {
254
+ "name" => "enableSequentialSigningAPI",
255
+ "value" => "true"
256
+ },
257
+ {
258
+ "name" => "enableSequentialSigningUI",
259
+ "value" => "true"
260
+ },
261
+ {
262
+ "name" => "enableSignerAttachments",
263
+ "value" => "true"
264
+ },
265
+ {
266
+ "name" => "enableSignOnPaper",
267
+ "value" => "true"
268
+ },
269
+ {
270
+ "name" => "enableSignOnPaperOverride",
271
+ "value" => "false"
272
+ },
273
+ {
274
+ "name" => "enableTransactionPoint",
275
+ "value" => "false"
276
+ },
277
+ {
278
+ "name" => "enableVaulting",
279
+ "value" => "false"
280
+ },
281
+ {
282
+ "name" => "envelopeIntegrationAllowed",
283
+ "value" => "full"
284
+ },
285
+ {
286
+ "name" => "envelopeIntegrationEnabled",
287
+ "value" => "false"
288
+ },
289
+ {
290
+ "name" => "envelopeStampingDefaultValue",
291
+ "value" => "false"
292
+ },
293
+ {
294
+ "name" => "idCheckExpire",
295
+ "value" => "always"
296
+ },
297
+ {
298
+ "name" => "idCheckExpireDays",
299
+ "value" => "0"
300
+ },
301
+ {
302
+ "name" => "idCheckRequired",
303
+ "value" => "never"
304
+ },
305
+ {
306
+ "name" => "pkiSignDownloadedPDFDocs",
307
+ "value" => "yes_sign"
308
+ },
309
+ {
310
+ "name" => "signDateFormat",
311
+ "value" => "M/d/yyyy"
312
+ },
313
+ {
314
+ "name" => "signerAttachCertificateToEnvelopePDF",
315
+ "value" => "false"
316
+ },
317
+ {
318
+ "name" => "signerCanCreateAccount",
319
+ "value" => "true"
320
+ },
321
+ {
322
+ "name" => "signerCanSignOnMobile",
323
+ "value" => "true"
324
+ },
325
+ {
326
+ "name" => "signerInSessionUseEnvelopeCompleteEmail",
327
+ "value" => "false"
328
+ },
329
+ {
330
+ "name" => "signerMustHaveAccount",
331
+ "value" => "false"
332
+ },
333
+ {
334
+ "name" => "signerMustLoginToSign",
335
+ "value" => "false"
336
+ },
337
+ {
338
+ "name" => "signerShowSecureFieldInitialValues",
339
+ "value" => "false"
340
+ },
341
+ {
342
+ "name" => "sessionTimeout",
343
+ "value" => "120"
344
+ },
345
+ {
346
+ "name" => "useAccountLevelEmail",
347
+ "value" => "true"
348
+ },
349
+ {
350
+ "name" => "usesAPI",
351
+ "value" => "false"
352
+ }
353
+ ]
354
+ }.to_json)
355
+ settings = @account.settings
356
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/settings.json")
357
+ assert_equal("false", settings["usesAPI"])
358
+ assert_equal("1234-asdf", settings.account_id)
359
+ end
360
+
361
+ should "be able to fetch templates" do
362
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/templates.json")
363
+ .to_return(:body => {
364
+ "envelopeTemplates" => [{
365
+ "description" => "String content",
366
+ "folderName" => "String content",
367
+ "folderUri" => "String content",
368
+ "lastModified" => "String content",
369
+ "name" => "String content",
370
+ "pageCount" => 2147483647,
371
+ "password" => "String content",
372
+ "shared" => "String content",
373
+ "templateId" => "String content",
374
+ "uri" => "String content"
375
+ }]
376
+ }.to_json)
377
+ templates = @account.templates
378
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/templates.json")
379
+ assert_equal(1, templates.length)
380
+ templates.each do |template|
381
+ assert_equal("1234-asdf", template.account_id)
382
+ end
383
+ end
384
+
385
+ should "be able to fetch users" do
386
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/users.json")
387
+ .to_return(:body => {
388
+ "users" => [{
389
+ "uri" => "String content",
390
+ "userId" => "String content",
391
+ "userName" => "String content",
392
+ "userStatus" => "String content",
393
+ "userType" => "String content"
394
+ }]
395
+ }.to_json)
396
+ users = @account.users
397
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/users.json")
398
+ assert_equal(1, users.length)
399
+ users.each do |user|
400
+ assert_equal("1234-asdf", user.account_id)
401
+ end
402
+ end
403
+ end
404
+
405
+ end
@@ -0,0 +1,35 @@
1
+ require 'test_helper'
2
+
3
+ class Docusigner::BaseTest < Test::Unit::TestCase
4
+
5
+ context "headers" do
6
+ teardown do
7
+ Docusigner::Base.instance_variable_set(:@headers, nil)
8
+ Docusigner::Account.instance_variable_set(:@headers, nil)
9
+ end
10
+
11
+ should "be inheritable" do
12
+ Docusigner::Base.headers['X-Foo'] = "bar"
13
+ assert_equal('bar', Docusigner::Account.headers['X-Foo'])
14
+
15
+ Docusigner::Account.headers["X-Bar"] = "foo"
16
+ assert_nil(Docusigner::Base.headers["X-Bar"])
17
+ end
18
+
19
+ should "authenticate via a bearer token" do
20
+ Docusigner::Base.token = "sometoken"
21
+ assert_equal("Bearer sometoken", Docusigner::Base.headers['Authorization'])
22
+ end
23
+
24
+ should "authenticate via username, password, integrator_key" do
25
+ Docusigner::Base.authorization = {
26
+ :username => "Jeff",
27
+ :password => "supersecure",
28
+ :integrator_key => "longkey",
29
+ }
30
+ assert_equal("<DocuSignCredentials><Username>Jeff</Username><Password>supersecure</Password><IntegratorKey>longkey</IntegratorKey></DocuSignCredentials>",
31
+ Docusigner::Base.headers['X-DocuSign-Authentication'])
32
+ end
33
+ end
34
+
35
+ end
@@ -0,0 +1,141 @@
1
+ require 'test_helper'
2
+
3
+ class Docusigner::EnvelopeTest < Test::Unit::TestCase
4
+
5
+ should "be able to create an envelope" do
6
+ @envelope = Docusigner::Envelope.new({
7
+ :account_id => "1234-asdf",
8
+ :emailSubject => "Fee Agreement",
9
+ :emailBlurb => "Please sign the attached agreement.",
10
+ :recipients => {
11
+ :signers => [
12
+ {
13
+ :email => "someone@somewhere.com",
14
+ :name => "Bob Smith",
15
+ :recipientId => "1",
16
+ }
17
+ ]
18
+ },
19
+ :documents => [
20
+ {
21
+ :name => "Fee Agreement.pdf",
22
+ :documentId => "1"
23
+ }
24
+ ],
25
+ :status => Docusigner::Envelope::Status::SENT
26
+ })
27
+ @envelope.add_document(File.open(File.expand_path("../../test.pdf", __FILE__)), 1)
28
+
29
+ stub_request(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes.json")
30
+ .to_return(:body => {
31
+ "envelopeId" => "someid",
32
+ "status" => "sent",
33
+ "statusDateTime" => "2013-02-21T14:28:35.0000000Z",
34
+ "uri" => "/envelopes/someid"
35
+ }.to_json)
36
+ @envelope.save
37
+ assert_requested(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes.json")
38
+ assert_equal("someid", @envelope.id)
39
+ end
40
+
41
+ context "an existing envelope" do
42
+ setup do
43
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890.json")
44
+ .to_return(:body => {
45
+ "allowReassign" => "true",
46
+ "certificateUri" => "/envelopes/qwer-7890/documents/certificate",
47
+ "createdDateTime" => "2013-02-26T21:07:46.8430000Z",
48
+ "customFieldsUri" => "/envelopes/qwer-7890/custom_fields",
49
+ "documentsCombinedUri" => "/envelopes/qwer-7890/documents/combined",
50
+ "documentsUri" => "/envelopes/qwer-7890/documents",
51
+ "emailBlurb" => "This is the blurb for the email.",
52
+ "emailSubject" => "SDK Example",
53
+ "enableWetSign" => "true",
54
+ "envelopeId" => "qwer-7890",
55
+ "envelopeUri" => "/envelopes/qwer-7890",
56
+ "notificationUri" => "/envelopes/qwer-7890/notification",
57
+ "recipientsUri" => "/envelopes/qwer-7890/recipients",
58
+ "sentDateTime" => "2013-02-26T21:07:47.1230000Z",
59
+ "status" => "sent",
60
+ "statusChangedDateTime" => "2013-02-26T21:07:47.1230000Z",
61
+ "templatesUri" => "/envelopes/qwer-7890/templates"
62
+ }.to_json)
63
+ @envelope = Docusigner::Envelope.find("qwer-7890", :params => {:account_id => "1234-asdf"})
64
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890.json")
65
+ end
66
+
67
+ should "be findable by id" do
68
+ assert_equal("qwer-7890", @envelope.id)
69
+ assert_equal("1234-asdf", @envelope.account_id)
70
+ end
71
+
72
+ should "be able to list recipients" do
73
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/recipients.json")
74
+ .to_return(:body => {
75
+ "agents" => [],
76
+ "carbonCopies" => [],
77
+ "certifiedDeliveries" => [],
78
+ "currentRoutingOrder" => "1",
79
+ "editors" => [],
80
+ "inPersonSigners" => [],
81
+ "intermediaries" => [],
82
+ "recipientCount" => "1",
83
+ "signers" => [
84
+ {
85
+ "recipientId" => "1",
86
+ "requireIdLookup" => "false",
87
+ "routingOrder" => "1",
88
+ "status" => "sent",
89
+ "email" => "david@avvo.com",
90
+ "name" => "David Doan"
91
+ }
92
+ ]
93
+ }.to_json)
94
+ recipients = @envelope.recipients
95
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/recipients.json")
96
+ assert_equal(1, recipients.count)
97
+ end
98
+
99
+ should "be able to get a recipient view url" do
100
+ stub_request(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/recipient.json")
101
+ .to_return(:body => {
102
+ "url" => "http://localhost/Member/StartInSession.aspx?t=d1cf42f2-30b6-499b-ab54-058fbf438103"
103
+ }.to_json)
104
+ url = @envelope.recipient_url({
105
+ :authenticationMethod => "email",
106
+ :email => "mike.rosey@docusign.com",
107
+ :returnUrl => "http://www.docusign.com",
108
+ :userName => "Mike Rosey",
109
+ :clientUserId => 333,
110
+ :recipientId => 1
111
+ })
112
+ assert_requested(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/recipient.json")
113
+ assert_equal("http://localhost/Member/StartInSession.aspx?t=d1cf42f2-30b6-499b-ab54-058fbf438103", url)
114
+ end
115
+
116
+ should "be able to get a sender view url" do
117
+ stub_request(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/sender.json")
118
+ .to_return(:body => {
119
+ "url" => "http://localhost/Member/StartInSession.aspx?StartConsole=1&t=6cafaeaa-cc6b-496d-812d-421b72f854de&DocuEnvelope=AB52A90E-BDC7-4F59-BFBD-90E32E984EA7&send=1"
120
+ }.to_json)
121
+ url = @envelope.sender_url({
122
+ :returnUrl => "http://www.docusign.com",
123
+ })
124
+ assert_requested(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/sender.json")
125
+ assert_equal("http://localhost/Member/StartInSession.aspx?StartConsole=1&t=6cafaeaa-cc6b-496d-812d-421b72f854de&DocuEnvelope=AB52A90E-BDC7-4F59-BFBD-90E32E984EA7&send=1", url)
126
+ end
127
+
128
+ should "be able to get a correction view url" do
129
+ stub_request(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/correct.json")
130
+ .to_return(:body => {
131
+ "url" => "http://localhost/someurl"
132
+ }.to_json)
133
+ url = @envelope.correct_url({
134
+ :returnUrl => "http://www.docusign.com",
135
+ })
136
+ assert_requested(:post, "https://demo.docusign.net/restapi/v2/accounts/1234-asdf/envelopes/qwer-7890/views/correct.json")
137
+ assert_equal("http://localhost/someurl", url)
138
+ end
139
+ end
140
+
141
+ end
@@ -0,0 +1,66 @@
1
+ require 'test_helper'
2
+
3
+ class Docusigner::LoginTest < Test::Unit::TestCase
4
+
5
+ should "be able to fetch login information" do
6
+ stub_request(:get, "https://demo.docusign.net/restapi/v2/login_information.json")
7
+ .to_return(:body => {
8
+ "apiPassword" => "base64encoded=",
9
+ "loginAccounts" => [
10
+ {
11
+ "accountId" => "1234",
12
+ "accountIdGuid" => "asdfawef23fwfwef",
13
+ "baseUrl" => "https://demo.docusign.net/restapi/v2/accounts/1234",
14
+ "email" => "myemail@gmail.com",
15
+ "isDefault" => "true",
16
+ "loginAccountSettings" => [
17
+ {
18
+ "name" => "usesAPI",
19
+ "value" => "false"
20
+ }
21
+ ],
22
+ "loginUserSettings" => [
23
+ {
24
+ "name" => "canManageAccount",
25
+ "value" => "true"
26
+ },
27
+ {
28
+ "name" => "canSendAPIRequests",
29
+ "value" => "false"
30
+ },
31
+ {
32
+ "name" => "canSendEnvelope",
33
+ "value" => "true"
34
+ },
35
+ {
36
+ "name" => "allowSendOnBehalfOf",
37
+ "value" => "true"
38
+ },
39
+ {
40
+ "name" => "apiAccountWideAccess",
41
+ "value" => "true"
42
+ }
43
+ ],
44
+ "name" => "Company.com",
45
+ "siteDescription" => "",
46
+ "userId" => "someguid",
47
+ "userName" => "Jeff Ching"
48
+ }
49
+ ]
50
+ }.to_json)
51
+ login_information = Docusigner::LoginInformation.find
52
+ assert_requested(:get, "https://demo.docusign.net/restapi/v2/login_information.json")
53
+ assert_equal(1, login_information.loginAccounts.length)
54
+ end
55
+
56
+ should "be able to update password" do
57
+ stub_request(:put, "https://demo.docusign.net/restapi/v2/login_information/password.json")
58
+ .with(:body => {
59
+ :currentPassword => "oldpw",
60
+ :email => "myemail@gmail.com",
61
+ :newPassword => "newpw"
62
+ }.to_json)
63
+ Docusigner::LoginInformation.change_password("myemail@gmail.com", "oldpw", "newpw")
64
+ assert_requested(:put, "https://demo.docusign.net/restapi/v2/login_information/password.json")
65
+ end
66
+ end