rmega 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/TODO.md +6 -0
- data/lib/rmega/nodes/expandable.rb +1 -1
- data/lib/rmega/version.rb +1 -1
- data/spec/integration/file_upload_spec.rb +1 -0
- data/spec/integration/folder_operations_spec.rb +27 -7
- metadata +3 -2
data/TODO.md
ADDED
@@ -0,0 +1,6 @@
|
|
1
|
+
## Rmega todos
|
2
|
+
|
3
|
+
* Handle timeouts in download/upload
|
4
|
+
* Handle error code -3 response, that is "A temporary congestion or server malfunction prevented your request from being processed.". I noticed that this occurs quite often when creating/deleting a folder node :/
|
5
|
+
* Search for TODO in the project for other minor tasks
|
6
|
+
* Resist the hypnotoad's will
|
@@ -10,7 +10,7 @@ module Rmega
|
|
10
10
|
encrypted_attributes = Utils.a32_to_base64 Crypto.encrypt_attributes(key[0..3], {n: name.strip})
|
11
11
|
encrypted_key = Utils.a32_to_base64 Crypto.encrypt_key(session.master_key, key)
|
12
12
|
n = [{h: 'xxxxxxxx', t: 1, a: encrypted_attributes, k: encrypted_key}]
|
13
|
-
data = session.request a: 'p', t:
|
13
|
+
data = session.request a: 'p', t: handle, n: n
|
14
14
|
Folder.new(session, data['f'][0])
|
15
15
|
end
|
16
16
|
|
data/lib/rmega/version.rb
CHANGED
@@ -61,6 +61,7 @@ describe 'File upload' do
|
|
61
61
|
|
62
62
|
let!(:folder) { @storage.root.create_folder(@name) }
|
63
63
|
|
64
|
+
# TODO: `let` and `subject` declarations are not intended to be called in a `before(:all)`
|
64
65
|
before(:all) { folder.upload(@path) }
|
65
66
|
|
66
67
|
it 'finds the uploaded file and verify its content' do
|
@@ -5,12 +5,14 @@ describe 'Folders operations' do
|
|
5
5
|
if account_file_exists?
|
6
6
|
|
7
7
|
before(:all) do
|
8
|
-
@name = "
|
8
|
+
@name = "folder_#{rand.denominator}_#{rand.denominator}"
|
9
|
+
@sub_folder_name = "folder_#{rand.denominator}_#{rand.denominator}"
|
9
10
|
@storage = login
|
10
11
|
end
|
11
12
|
|
12
|
-
|
13
|
-
|
13
|
+
# Note: node searching is traversal
|
14
|
+
def find_folder(name)
|
15
|
+
@storage.nodes.find { |f| f.type == :folder && f.name == name }
|
14
16
|
end
|
15
17
|
|
16
18
|
context 'when #create_folder is called on a node' do
|
@@ -18,24 +20,42 @@ describe 'Folders operations' do
|
|
18
20
|
it 'creates a new folder under that node' do
|
19
21
|
folder = @storage.root.create_folder(@name)
|
20
22
|
expect(folder.name).to eql @name
|
23
|
+
expect(folder.parent_handle).to eq @storage.root.handle
|
21
24
|
end
|
22
25
|
end
|
23
26
|
|
24
27
|
context 'searching for a folder by its name' do
|
25
28
|
|
26
29
|
it 'returns the matching folder' do
|
27
|
-
expect(find_folder.name).to eql @name
|
30
|
+
expect(find_folder(@name).name).to eql @name
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when #create_folder under created folder" do
|
35
|
+
|
36
|
+
it "creates a new folder under created folder" do
|
37
|
+
parent_folder = find_folder(@name)
|
38
|
+
|
39
|
+
sub_folder = parent_folder.create_folder(@sub_folder_name)
|
40
|
+
|
41
|
+
expect(parent_folder.folders.first.name).to eql @sub_folder_name
|
42
|
+
expect(sub_folder.parent_handle).to eql parent_folder.handle
|
28
43
|
end
|
29
44
|
end
|
30
45
|
|
31
46
|
context 'when #delete is called on a folder node' do
|
32
47
|
|
48
|
+
it 'deletes sub folder' do
|
49
|
+
expect(find_folder(@sub_folder_name).delete).to eql 0
|
50
|
+
end
|
51
|
+
|
33
52
|
it 'deletes the folder' do
|
34
|
-
expect(find_folder.delete).to eql 0
|
53
|
+
expect(find_folder(@name).delete).to eql 0
|
35
54
|
end
|
36
55
|
|
37
|
-
it 'does not find the folder anymore' do
|
38
|
-
expect(find_folder).to be_nil
|
56
|
+
it 'does not find the folder (and its subfolder) anymore' do
|
57
|
+
expect(find_folder(@name)).to be_nil
|
58
|
+
expect(find_folder(@sub_folder_name)).to be_nil
|
39
59
|
end
|
40
60
|
end
|
41
61
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rmega
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: pry
|
@@ -119,6 +119,7 @@ files:
|
|
119
119
|
- LICENSE
|
120
120
|
- README.md
|
121
121
|
- Rakefile
|
122
|
+
- TODO.md
|
122
123
|
- lib/rmega.rb
|
123
124
|
- lib/rmega/crypto/aes.rb
|
124
125
|
- lib/rmega/crypto/aes_ctr.rb
|