nvx-sds 0.0.1
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.
- data/LICENSE +64 -0
- data/README +80 -0
- data/lib/nvx/sds/APIClasses/accountfeatureusage.rb +60 -0
- data/lib/nvx/sds/APIClasses/accountinfo.rb +30 -0
- data/lib/nvx/sds/APIClasses/accountlimit.rb +25 -0
- data/lib/nvx/sds/APIClasses/contactinfo.rb +74 -0
- data/lib/nvx/sds/APIClasses/fsfileattributes.rb +50 -0
- data/lib/nvx/sds/APIClasses/fsfolderattributes.rb +53 -0
- data/lib/nvx/sds/APIClasses/fsfolderlist.rb +70 -0
- data/lib/nvx/sds/APIClasses/metadatainfo.rb +26 -0
- data/lib/nvx/sds/APIClasses/responsecodes.rb +97 -0
- data/lib/nvx/sds/APIClasses/soapupload.rb +52 -0
- data/lib/nvx/sds/APIClasses/utilities.rb +97 -0
- data/lib/nvx/sds/SOAP/TransferClient.rb +68 -0
- data/lib/nvx/sds/SOAP/default.rb +80 -0
- data/lib/nvx/sds/SOAP/defaultDriver.rb +70 -0
- data/lib/nvx/sds/accountlogin.rb +68 -0
- data/lib/nvx/sds/apicommand.rb +251 -0
- data/lib/nvx/sds/apiparam.rb +33 -0
- data/lib/nvx/sds/countries.rb +257 -0
- data/lib/nvx/sds/folder.rb +236 -0
- data/lib/nvx/sds/hosteditem.rb +115 -0
- data/lib/nvx/sds/itembase.rb +53 -0
- data/lib/nvx/sds/masteraccount.rb +74 -0
- data/lib/nvx/sds/nvxfile.rb +173 -0
- data/lib/nvx/sds/session.rb +110 -0
- data/lib/nvx/sds/transport.rb +129 -0
- data/lib/nvx_sds.rb +19 -0
- data/tests/TestUpload.txt +9 -0
- data/tests/accountlogintest.rb +19 -0
- data/tests/apicommandtest.rb +186 -0
- data/tests/apiparamtest.rb +24 -0
- data/tests/countriestest.rb +20 -0
- data/tests/foldertest.rb +26 -0
- data/tests/fsfolderlisttest.rb +127 -0
- data/tests/masteraccounttest.rb +69 -0
- data/tests/sessiontest.rb +187 -0
- data/tests/testconfig.rb +14 -0
- data/tests/transporttest.rb +19 -0
- data/tests/unittests_gemtest.rb +17 -0
- data/tests/uploadtest.rb +22 -0
- metadata +102 -0
@@ -0,0 +1,127 @@
|
|
1
|
+
# fsfolderlist test
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
5
|
+
require 'nvx/sds/apicommand'
|
6
|
+
require 'nvx/sds/apiparam'
|
7
|
+
require 'nvx/sds/transport'
|
8
|
+
require 'nvx/sds/accountlogin'
|
9
|
+
require 'nvx/sds/apiclasses/fsfolderlist'
|
10
|
+
require 'REXML/Document'
|
11
|
+
include REXML
|
12
|
+
|
13
|
+
class FSFolderListTest < Test::Unit::TestCase
|
14
|
+
include NVX::SDS
|
15
|
+
|
16
|
+
Newline ||= "\r\n"
|
17
|
+
def test_mock_TotalFolderCountTest
|
18
|
+
xml = "<Response><ResponseCode>0</ResponseCode><ListFolder><TotalFolderCount>1</TotalFolderCount><TotalFileCount>0</TotalFileCount><PageFolderCount>1</PageFolderCount><PageFileCount>0</PageFileCount><Folder><FolderCount>0</FolderCount><FileCount>3</FileCount><Name>bleach</Name><Path>bleach</Path><CreatedDate>Wed, 29 Aug 2007 19:22:24 GMT</CreatedDate><Metadata/><FileTags/></Folder></ListFolder></Response>"
|
19
|
+
|
20
|
+
fsfolderlist = FSFolderList.new(xml)
|
21
|
+
|
22
|
+
assert fsfolderlist.total_folder_count == 1
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_mock_TotalFolderCountNullTest
|
26
|
+
xml = "<Response><ResponseCode>0</ResponseCode><ListFolder><TotalFolderCount></TotalFolderCount><TotalFileCount>0</TotalFileCount><PageFolderCount>1</PageFolderCount><PageFileCount>0</PageFileCount><Folder><FolderCount>0</FolderCount><FileCount>3</FileCount><Name>bleach</Name><Path>bleach</Path><CreatedDate>Wed, 29 Aug 2007 19:22:24 GMT</CreatedDate><Metadata/><FileTags/></Folder></ListFolder></Response>"
|
27
|
+
|
28
|
+
fsfolderlist = FSFolderList.new(xml)
|
29
|
+
|
30
|
+
assert fsfolderlist.total_folder_count == 0
|
31
|
+
end
|
32
|
+
|
33
|
+
|
34
|
+
def test_mock_CheckFileItemTest
|
35
|
+
xml = "<Response><ResponseCode>0</ResponseCode><ListFolder><TotalFolderCount></TotalFolderCount><TotalFileCount>0</TotalFileCount><PageFolderCount>1</PageFolderCount><PageFileCount>0</PageFileCount><Folder><FolderCount>0</FolderCount><FileCount>3</FileCount><Name>test</Name><Path>bleach</Path><CreatedDate>Wed, 29 Aug 2007 19:22:24 GMT</CreatedDate><Metadata/><FileTags/></Folder></ListFolder></Response>"
|
36
|
+
|
37
|
+
fsfolderlist = FSFolderList.new(xml)
|
38
|
+
|
39
|
+
assert fsfolderlist.folder_attributes[0].file_count.to_i == 3
|
40
|
+
assert fsfolderlist.folder_attributes[0].name == "test"
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_CheckFileItemTest
|
45
|
+
xml = 'RESPONSE XML: n++<?xml version="1.0" encoding="utf-8"?>
|
46
|
+
<Response>
|
47
|
+
<ResponseCode>0</ResponseCode>
|
48
|
+
<ListFolder>
|
49
|
+
<TotalFolderCount>1</TotalFolderCount>
|
50
|
+
<TotalFileCount>6</TotalFileCount>
|
51
|
+
<PageFolderCount>1</PageFolderCount>
|
52
|
+
<PageFileCount>6</PageFileCount>
|
53
|
+
<Folder>
|
54
|
+
<FolderCount>0</FolderCount>
|
55
|
+
<FileCount>1</FileCount>
|
56
|
+
<Name>upload</Name>
|
57
|
+
<Path>//Upload Test/uploadtest/upload</Path>
|
58
|
+
<CreatedDate>Wed, 29 Aug 2007 17:33:51 GMT</CreatedDate>
|
59
|
+
|
60
|
+
<Metadata />
|
61
|
+
<FileTags />
|
62
|
+
</Folder>
|
63
|
+
<File>
|
64
|
+
<SizeBytes>667</SizeBytes>
|
65
|
+
<Name>APIList.txt</Name>
|
66
|
+
<Path>//Upload Test/uploadtest/APIList.txt</Path>
|
67
|
+
<CreatedDate>Wed, 22 Aug 2007 16:30:48 GMT</CreatedDate>
|
68
|
+
|
69
|
+
<Metadata />
|
70
|
+
<FileTags />
|
71
|
+
</File>
|
72
|
+
<File>
|
73
|
+
<SizeBytes>141771</SizeBytes>
|
74
|
+
<Name>FFVIII_1024.jpg</Name>
|
75
|
+
<Path>//Upload Test/uploadtest/FFVIII_1024.jpg</Path>
|
76
|
+
<CreatedDate>Tue, 21 Aug 2007 18:32:07 GMT</CreatedDate>
|
77
|
+
|
78
|
+
<Metadata><Metadata FileName="FFVIII_1024.jpg"><Data Key="Height">768</Data><Data Key="Width">1024</Data></Metadata></Metadata>
|
79
|
+
<FileTags />
|
80
|
+
</File>
|
81
|
+
<File>
|
82
|
+
<SizeBytes>2396160</SizeBytes>
|
83
|
+
<Name>Paranoid.mp3</Name>
|
84
|
+
<Path>//Upload Test/uploadtest/Paranoid.mp3</Path>
|
85
|
+
<CreatedDate>Wed, 22 Aug 2007 18:41:24 GMT</CreatedDate>
|
86
|
+
|
87
|
+
<Metadata><Metadata FileName="Paranoid.mp3"><Data Key="Album">We Sold Our Soul For Rock Roll</Data><Data Key="Artist">Black Sabbath</Data><Data Key="BitRate">112</Data><Data Key="Duration">171</Data><Data Key="Genre">Metal</Data><Data Key="IsVariableBitRate">0</Data><Data Key="Title">Paranoid</Data><Data Key="Track">32</Data></Metadata></Metadata>
|
88
|
+
<FileTags />
|
89
|
+
</File>
|
90
|
+
<File>
|
91
|
+
<SizeBytes>6656</SizeBytes>
|
92
|
+
<Name>Thumbs.db</Name>
|
93
|
+
<Path>//Upload Test/uploadtest/Thumbs.db</Path>
|
94
|
+
<CreatedDate>Wed, 22 Aug 2007 18:01:49 GMT</CreatedDate>
|
95
|
+
|
96
|
+
<Metadata />
|
97
|
+
<FileTags />
|
98
|
+
</File>
|
99
|
+
<File>
|
100
|
+
<SizeBytes>1244</SizeBytes>
|
101
|
+
<Name>UploadBencher.exe.config</Name>
|
102
|
+
<Path>//Upload Test/uploadtest/UploadBencher.exe.config</Path>
|
103
|
+
<CreatedDate>Tue, 21 Aug 2007 18:14:52 GMT</CreatedDate>
|
104
|
+
|
105
|
+
<Metadata />
|
106
|
+
<FileTags />
|
107
|
+
</File>
|
108
|
+
<File>
|
109
|
+
<SizeBytes>5632</SizeBytes>
|
110
|
+
<Name>UploadBencher.vshost.exe</Name>
|
111
|
+
<Path>//Upload Test/uploadtest/UploadBencher.vshost.exe</Path>
|
112
|
+
<CreatedDate>Tue, 21 Aug 2007 18:13:09 GMT</CreatedDate>
|
113
|
+
|
114
|
+
<Metadata />
|
115
|
+
<FileTags />
|
116
|
+
</File>
|
117
|
+
</ListFolder>
|
118
|
+
</Response>'
|
119
|
+
fsfolderlist = FSFolderList.new(xml)
|
120
|
+
|
121
|
+
print fsfolderlist.folder_attributes[0].file_count
|
122
|
+
assert fsfolderlist.folder_attributes[0].file_count.to_i == 1
|
123
|
+
print fsfolderlist.folder_attributes[0].name
|
124
|
+
assert fsfolderlist.folder_attributes[0].name == "upload"
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
require File.dirname(__FILE__) + '/testconfig'
|
4
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/nvx/sds/'
|
5
|
+
require 'apicommand'
|
6
|
+
require 'apiparam'
|
7
|
+
require 'session'
|
8
|
+
require 'masteraccount'
|
9
|
+
require 'REXML/Document'
|
10
|
+
include REXML
|
11
|
+
|
12
|
+
class MasterAccountTest < Test::Unit::TestCase
|
13
|
+
include NVX::SDS
|
14
|
+
|
15
|
+
def test_CreateChildAccount
|
16
|
+
session = Session.new(APP_KEY, MASTERUSERNAME, APP_NAME, MASTERPASSWORD)
|
17
|
+
masteraccount = session.GetMasterAccount
|
18
|
+
begin
|
19
|
+
masteraccount.DeleteChildAccount("testchildcreate")
|
20
|
+
rescue
|
21
|
+
# allow delete to fail
|
22
|
+
end
|
23
|
+
masteraccount.CreateChildAccount("testchildcreate", "somepass")
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_DeleteChildAccount
|
27
|
+
session = Session.new(APP_KEY, MASTERUSERNAME, APP_NAME, MASTERPASSWORD)
|
28
|
+
masteraccount = session.GetMasterAccount
|
29
|
+
begin
|
30
|
+
masteraccount.DeleteChildAccount("deletechildtest")
|
31
|
+
rescue
|
32
|
+
# allow delete to fail
|
33
|
+
end
|
34
|
+
masteraccount.CreateChildAccount("deletechildtest", "somepass")
|
35
|
+
masteraccount.DeleteChildAccount("deletechildtest")
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_AccountNotesSetGet
|
39
|
+
session = Session.new(APP_KEY, MASTERUSERNAME, APP_NAME, MASTERPASSWORD)
|
40
|
+
masteraccount = session.GetMasterAccount
|
41
|
+
|
42
|
+
begin
|
43
|
+
masteraccount.CreateChildAccount("testchildcreate", "somepass")
|
44
|
+
rescue
|
45
|
+
# Just a temp account to test notes with. It may alreayd exist from
|
46
|
+
# an earlier test.
|
47
|
+
end
|
48
|
+
|
49
|
+
masteraccount.SetAccountNotes("testchildcreate", "<Sometest>A Value</Sometest>")
|
50
|
+
assert masteraccount.GetAccountNotes("testchildcreate").to_s == "<Sometest>A Value</Sometest>"
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_ImpersonateChildAccount
|
54
|
+
session = Session.new(APP_KEY, MASTERUSERNAME, APP_NAME, MASTERPASSWORD)
|
55
|
+
masteraccount = session.GetMasterAccount
|
56
|
+
|
57
|
+
begin
|
58
|
+
masteraccount.CreateChildAccount("testchildcreate", "somepass")
|
59
|
+
rescue
|
60
|
+
# Just a temp account to test notes with. It may alreayd exist from
|
61
|
+
# an earlier test.
|
62
|
+
end
|
63
|
+
|
64
|
+
child_session = masteraccount.ImpersonateChildAccount("testchildcreate")
|
65
|
+
|
66
|
+
account_info = child_session.GetAccountInfo
|
67
|
+
assert account_info.username.to_s == "testchildcreate"
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,187 @@
|
|
1
|
+
# session test
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
5
|
+
require 'nvx/sds/session'
|
6
|
+
require 'nvx/sds/countries'
|
7
|
+
require 'nvx/sds/apiclasses/metadatainfo'
|
8
|
+
require 'REXML/Document'
|
9
|
+
require File.dirname(__FILE__) + '/testconfig'
|
10
|
+
include REXML
|
11
|
+
|
12
|
+
class SessionTest < Test::Unit::TestCase
|
13
|
+
include NVX::SDS
|
14
|
+
|
15
|
+
Newline = "\r\n"
|
16
|
+
|
17
|
+
def test_SessionLogin
|
18
|
+
# validate the session can be properly created.
|
19
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
20
|
+
assert !session.nil?
|
21
|
+
end
|
22
|
+
|
23
|
+
def test_SessionLogout
|
24
|
+
# validate the session is destroyed after a logout
|
25
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
26
|
+
session.Logout
|
27
|
+
end
|
28
|
+
|
29
|
+
def test_GetRootFolder
|
30
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
31
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
32
|
+
assert !root_folder.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
def test_RenameFolder
|
36
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
37
|
+
|
38
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
39
|
+
|
40
|
+
assert_raise(RuntimeError) do
|
41
|
+
root_folder.Rename("New Folder Name")
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_GetRootFolderLoadChildren
|
46
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
47
|
+
# page_number, page_size, folder_sort_code, should_sort_descending
|
48
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
49
|
+
|
50
|
+
assert !root_folder.nil?
|
51
|
+
root_folder.LoadChildren(1, 500, 0, true)
|
52
|
+
end
|
53
|
+
|
54
|
+
def test_RenameFile
|
55
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
56
|
+
# page_number, page_size, folder_sort_code, should_sort_descending
|
57
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
58
|
+
|
59
|
+
assert !root_folder.nil?
|
60
|
+
root_folder.LoadChildren(1, 500, 0, true)
|
61
|
+
root_folder.files.each do |file|
|
62
|
+
if file.name == "notAPIList.txt"
|
63
|
+
file.Rename("APIList.txt")
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def test_CreateFolder
|
69
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
70
|
+
# page_number, page_size, folder_sort_code, should_sort_descending
|
71
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
72
|
+
|
73
|
+
assert !root_folder.nil?
|
74
|
+
begin
|
75
|
+
session.DeleteFolders(["testfolder"])
|
76
|
+
rescue
|
77
|
+
#handle missing folder
|
78
|
+
end
|
79
|
+
root_folder.CreateFolders(["testfolder"])
|
80
|
+
#Since we don't define or store the paging information we need to do our
|
81
|
+
#own loadchildren after a create folder
|
82
|
+
root_folder.LoadChildren(1, 500, 0, true)
|
83
|
+
end
|
84
|
+
|
85
|
+
def test_RenameFolder
|
86
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
87
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
88
|
+
|
89
|
+
begin
|
90
|
+
session.DeleteFolders(["/renamefolder"])
|
91
|
+
rescue
|
92
|
+
#handle missing folder
|
93
|
+
end
|
94
|
+
root_folder.CreateFolders(["/beforerenamefolder"])
|
95
|
+
root_folder.LoadChildren(1, 500, 0, true)
|
96
|
+
|
97
|
+
#find the folder in the list and rename it.
|
98
|
+
root_folder.folders.each do |folder|
|
99
|
+
if folder.name == "beforerenamefolder"
|
100
|
+
folder.Rename("renamefolder")
|
101
|
+
break
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_Metadata
|
108
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
109
|
+
# page_number, page_size, folder_sort_code, should_sort_descending
|
110
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
111
|
+
root_folder.files[0].SetMetadata([MetadataInfo.new("Test", "Data")])
|
112
|
+
root_folder.files[0].GetMetadata
|
113
|
+
end
|
114
|
+
|
115
|
+
def test_Tags
|
116
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
117
|
+
# page_number, page_size, folder_sort_code, should_sort_descending
|
118
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
119
|
+
|
120
|
+
root_folder.files[0].SetTags(["TestTag"])
|
121
|
+
root_folder.files[0].GetTags
|
122
|
+
end
|
123
|
+
|
124
|
+
def test_DownloadFile
|
125
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
126
|
+
|
127
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
128
|
+
root_folder.files[0].DownloadToLocalFile("c:\\test123.txt")
|
129
|
+
download_url = root_folder.files[1].GetDownloadUrl
|
130
|
+
assert !download_url.nil?
|
131
|
+
end
|
132
|
+
|
133
|
+
def test_AccountSetGet
|
134
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
135
|
+
|
136
|
+
session.SetAccountInfo("First", "Last", "M", "123-123-1234", "me@here.now",
|
137
|
+
"TEXT", "123 here st.", "Unit 11", "City", "St", Countries.country_list["United States"], "12345")
|
138
|
+
|
139
|
+
account_info = session.GetAccountInfo
|
140
|
+
assert account_info.contact.first_name.to_s == "First"
|
141
|
+
assert account_info.username.to_s == "uploadtest"
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_AccountLimits
|
145
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
146
|
+
limits = session.GetAccountLimits
|
147
|
+
assert limits.length == 4
|
148
|
+
end
|
149
|
+
|
150
|
+
def test_AccountFeatures
|
151
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
152
|
+
features = session.GetAccountUsage
|
153
|
+
assert features.length == 3
|
154
|
+
# features.each do |usage|
|
155
|
+
# print "Usage: " + usage.feature_name.to_s + Newline
|
156
|
+
# # if we output the usage.to_s and the usage is a large number Aptana IDE has a "Match Job" error
|
157
|
+
# # but this is not a problem under ruby itself.
|
158
|
+
# end
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_hostedItems
|
162
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
163
|
+
root_folder = session.GetRootFolder(1, 500, 0, true)
|
164
|
+
begin
|
165
|
+
session.DeleteFolders(["/testhostfolder"])
|
166
|
+
rescue
|
167
|
+
#handle missing folder
|
168
|
+
end
|
169
|
+
root_folder.CreateFolders(["testhostfolder"])
|
170
|
+
root_folder.LoadChildren(1, 500, 0, true)
|
171
|
+
host_folder = ""
|
172
|
+
root_folder.folders.each do |folder|
|
173
|
+
if folder.name == "testhostfolder"
|
174
|
+
host_folder = folder
|
175
|
+
break
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
host_folder.HostItem
|
180
|
+
hosted_items = session.ListHostedItems
|
181
|
+
assert hosted_items.length == 2
|
182
|
+
|
183
|
+
host_folder.RemoveHostedItem
|
184
|
+
session.DeleteFolders([host_folder.path])
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
data/tests/testconfig.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# This file is used to configure the Unit tests and assign an account to test with.
|
2
|
+
# If you do not already have a Nirvanix account go to http://nmp.nirvanix.com/ and sign up.
|
3
|
+
|
4
|
+
# Replace these values with your own to run unit tests.
|
5
|
+
APP_KEY = "FB8EC93D-B266-49E8-9CC6-4381D1E2D69D"
|
6
|
+
APP_NAME = "Upload Test"
|
7
|
+
|
8
|
+
# Below is the information for testing a child or master account.
|
9
|
+
USERNAME = "childtest"
|
10
|
+
PASSWORD = "testpass"
|
11
|
+
|
12
|
+
# Below is the master account information for testing the master account calls.
|
13
|
+
MASTERUSERNAME = "mastertest"
|
14
|
+
MASTERPASSWORD = "testpass"
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# transport test
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require File.dirname(__FILE__) + '/testconfig'
|
5
|
+
$:.unshift File.dirname(__FILE__) + '/../lib'
|
6
|
+
require 'nvx/sds/apicommand'
|
7
|
+
require 'nvx/sds/apiparam'
|
8
|
+
require 'nvx/sds/transport'
|
9
|
+
|
10
|
+
class TransportTest < Test::Unit::TestCase
|
11
|
+
include NVX::SDS
|
12
|
+
|
13
|
+
def test_Transport
|
14
|
+
# This test verifies both secure and non-secure calls.
|
15
|
+
result = Transport.execute_command_post(APICommand.Login, [APIParam.new("appKey", APP_KEY), APIParam.new("username", USERNAME), APIParam.new("password", PASSWORD)], nil)
|
16
|
+
sessionToken = result.root.elements["SessionToken"].get_text.value
|
17
|
+
assert !sessionToken.nil?
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
class Unittests < Test::Unit::TestCase
|
2
|
+
|
3
|
+
require 'test/unit'
|
4
|
+
require File.dirname(__FILE__) + '/testconfig'
|
5
|
+
require 'nvx_sds'
|
6
|
+
|
7
|
+
# This unit test accesses the Gem library rather than directly at the source, this
|
8
|
+
# Tests that the Gem is properly installed and shows how to require the gem and use it.
|
9
|
+
def test_LoginGem
|
10
|
+
accountLogin = NVX::SDS::AccountLogin.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
11
|
+
accountLogin.Login
|
12
|
+
assert accountLogin.username == "uploadtest"
|
13
|
+
assert accountLogin.app_name == "Upload Test"
|
14
|
+
assert accountLogin.session_token != nil
|
15
|
+
print "Session Token: " + accountLogin.session_token
|
16
|
+
end
|
17
|
+
end
|
data/tests/uploadtest.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
|
2
|
+
require 'test/unit'
|
3
|
+
$:.unshift File.dirname(__FILE__) + '/../lib/nvx/sds/'
|
4
|
+
require 'session'
|
5
|
+
require 'REXML/Document'
|
6
|
+
require 'soapupload'
|
7
|
+
require File.dirname(__FILE__) + '/testconfig'
|
8
|
+
include REXML
|
9
|
+
|
10
|
+
class Uploadtest < Test::Unit::TestCase
|
11
|
+
include NVX::SDS
|
12
|
+
def test_UploadFile
|
13
|
+
session = Session.new(APP_KEY, USERNAME, APP_NAME, PASSWORD)
|
14
|
+
|
15
|
+
remote_file = "/TestUpload.txt"
|
16
|
+
local_file = File.expand_path(File.join(File.dirname(__FILE__), '.')) + remote_file
|
17
|
+
print local_file
|
18
|
+
SoapUpload.UploadFile(remote_file, local_file, session.account_login)
|
19
|
+
# remove file after uploading
|
20
|
+
session.DeleteFiles([remote_file])
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
rubygems_version: 0.9.2
|
3
|
+
specification_version: 1
|
4
|
+
name: nvx-sds
|
5
|
+
version: !ruby/object:Gem::Version
|
6
|
+
version: 0.0.1
|
7
|
+
date: 2007-10-08 00:00:00 -07:00
|
8
|
+
summary: A package for accessing the Nirvanix SDS allowing remote file storage, retrieval and account operations.
|
9
|
+
require_paths:
|
10
|
+
- lib
|
11
|
+
email: barry @nospam@ nirvanix.com
|
12
|
+
homepage: http://nvx-sds.rubyforge.org/
|
13
|
+
rubyforge_project: nvx-sds
|
14
|
+
description:
|
15
|
+
autorequire: nvx_sds
|
16
|
+
default_executable:
|
17
|
+
bindir: bin
|
18
|
+
has_rdoc: true
|
19
|
+
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">"
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.0.0
|
24
|
+
version:
|
25
|
+
platform: ruby
|
26
|
+
signing_key:
|
27
|
+
cert_chain:
|
28
|
+
post_install_message:
|
29
|
+
authors:
|
30
|
+
- Barry Ruffner
|
31
|
+
files:
|
32
|
+
- lib/nvx_sds.rb
|
33
|
+
- lib/nvx/sds/accountlogin.rb
|
34
|
+
- lib/nvx/sds/apicommand.rb
|
35
|
+
- lib/nvx/sds/apiparam.rb
|
36
|
+
- lib/nvx/sds/countries.rb
|
37
|
+
- lib/nvx/sds/folder.rb
|
38
|
+
- lib/nvx/sds/hosteditem.rb
|
39
|
+
- lib/nvx/sds/itembase.rb
|
40
|
+
- lib/nvx/sds/masteraccount.rb
|
41
|
+
- lib/nvx/sds/nvxfile.rb
|
42
|
+
- lib/nvx/sds/session.rb
|
43
|
+
- lib/nvx/sds/transport.rb
|
44
|
+
- lib/nvx/sds/APIClasses/accountfeatureusage.rb
|
45
|
+
- lib/nvx/sds/APIClasses/accountinfo.rb
|
46
|
+
- lib/nvx/sds/APIClasses/accountlimit.rb
|
47
|
+
- lib/nvx/sds/APIClasses/contactinfo.rb
|
48
|
+
- lib/nvx/sds/APIClasses/fsfileattributes.rb
|
49
|
+
- lib/nvx/sds/APIClasses/fsfolderattributes.rb
|
50
|
+
- lib/nvx/sds/APIClasses/fsfolderlist.rb
|
51
|
+
- lib/nvx/sds/APIClasses/metadatainfo.rb
|
52
|
+
- lib/nvx/sds/APIClasses/responsecodes.rb
|
53
|
+
- lib/nvx/sds/APIClasses/soapupload.rb
|
54
|
+
- lib/nvx/sds/APIClasses/utilities.rb
|
55
|
+
- lib/nvx/sds/SOAP/default.rb
|
56
|
+
- lib/nvx/sds/SOAP/defaultDriver.rb
|
57
|
+
- lib/nvx/sds/SOAP/TransferClient.rb
|
58
|
+
- tests/accountlogintest.rb
|
59
|
+
- tests/apicommandtest.rb
|
60
|
+
- tests/apiparamtest.rb
|
61
|
+
- tests/countriestest.rb
|
62
|
+
- tests/foldertest.rb
|
63
|
+
- tests/fsfolderlisttest.rb
|
64
|
+
- tests/masteraccounttest.rb
|
65
|
+
- tests/sessiontest.rb
|
66
|
+
- tests/testconfig.rb
|
67
|
+
- tests/TestUpload.txt
|
68
|
+
- tests/transporttest.rb
|
69
|
+
- tests/unittests_gemtest.rb
|
70
|
+
- tests/uploadtest.rb
|
71
|
+
- LICENSE
|
72
|
+
- README
|
73
|
+
test_files:
|
74
|
+
- tests/accountlogintest.rb
|
75
|
+
- tests/apicommandtest.rb
|
76
|
+
- tests/apiparamtest.rb
|
77
|
+
- tests/countriestest.rb
|
78
|
+
- tests/foldertest.rb
|
79
|
+
- tests/fsfolderlisttest.rb
|
80
|
+
- tests/masteraccounttest.rb
|
81
|
+
- tests/sessiontest.rb
|
82
|
+
- tests/testconfig.rb
|
83
|
+
- tests/transporttest.rb
|
84
|
+
- tests/unittests_gemtest.rb
|
85
|
+
- tests/uploadtest.rb
|
86
|
+
rdoc_options:
|
87
|
+
- --exclude
|
88
|
+
- definitions
|
89
|
+
- --exclude
|
90
|
+
- indexes
|
91
|
+
- --inline-source
|
92
|
+
extra_rdoc_files:
|
93
|
+
- LICENSE
|
94
|
+
- README
|
95
|
+
executables: []
|
96
|
+
|
97
|
+
extensions: []
|
98
|
+
|
99
|
+
requirements: []
|
100
|
+
|
101
|
+
dependencies: []
|
102
|
+
|