MrMurano 1.6.3 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -2
  3. data/Gemfile +1 -1
  4. data/MrMurano.gemspec +1 -1
  5. data/README.markdown +4 -0
  6. data/TODO.taskpaper +17 -4
  7. data/lib/MrMurano/Account.rb +5 -1
  8. data/lib/MrMurano/Config.rb +3 -1
  9. data/lib/MrMurano/Product-Resources.rb +239 -0
  10. data/lib/MrMurano/Product.rb +51 -2
  11. data/lib/MrMurano/Solution-Cors.rb +81 -0
  12. data/lib/MrMurano/Solution-Endpoint.rb +8 -4
  13. data/lib/MrMurano/Solution-File.rb +4 -2
  14. data/lib/MrMurano/Solution-ServiceConfig.rb +74 -1
  15. data/lib/MrMurano/Solution-Services.rb +4 -2
  16. data/lib/MrMurano/Solution-Users.rb +6 -3
  17. data/lib/MrMurano/Solution.rb +6 -274
  18. data/lib/MrMurano/SyncUpDown.rb +433 -0
  19. data/lib/MrMurano/commands/completion.rb +152 -0
  20. data/lib/MrMurano/commands/content.rb +15 -14
  21. data/lib/MrMurano/commands/cors.rb +11 -38
  22. data/lib/MrMurano/commands/exportImport.rb +4 -3
  23. data/lib/MrMurano/commands/keystore.rb +15 -16
  24. data/lib/MrMurano/commands/logs.rb +2 -2
  25. data/lib/MrMurano/commands/productCreate.rb +4 -4
  26. data/lib/MrMurano/commands/productDelete.rb +6 -8
  27. data/lib/MrMurano/commands/productSpec.rb +31 -36
  28. data/lib/MrMurano/commands/productWrite.rb +9 -7
  29. data/lib/MrMurano/commands/serialNumberCmds.rb +4 -4
  30. data/lib/MrMurano/commands/solutionCreate.rb +4 -4
  31. data/lib/MrMurano/commands/solutionDelete.rb +5 -5
  32. data/lib/MrMurano/commands/status.rb +9 -42
  33. data/lib/MrMurano/commands/sync.rb +15 -71
  34. data/lib/MrMurano/commands/timeseries.rb +23 -29
  35. data/lib/MrMurano/commands/tsdb.rb +202 -0
  36. data/lib/MrMurano/commands/zshcomplete.erb +112 -0
  37. data/lib/MrMurano/commands.rb +4 -1
  38. data/lib/MrMurano/http.rb +4 -3
  39. data/lib/MrMurano/makePretty.rb +15 -6
  40. data/lib/MrMurano/verbosing.rb +71 -0
  41. data/lib/MrMurano/version.rb +1 -1
  42. data/lib/MrMurano.rb +1 -0
  43. data/spec/ConfigFile_spec.rb +3 -3
  44. data/spec/ProductContent_spec.rb +2 -2
  45. data/spec/ProductResources_spec.rb +152 -0
  46. data/spec/Product_spec.rb +38 -1
  47. data/spec/Solution-Cors_spec.rb +134 -0
  48. data/spec/Solution-ServiceConfig_spec.rb +198 -0
  49. data/spec/SyncRoot_spec.rb +74 -0
  50. data/spec/cmd_config_spec.rb +51 -0
  51. data/spec/fixtures/.mrmuranorc +9 -0
  52. data/spec/{testfiles → fixtures}/configfile +0 -0
  53. data/spec/fixtures/mrmuranorc_deleted_bob +8 -0
  54. data/spec/fixtures/product_spec_files/example.exoline.spec.yaml +116 -0
  55. data/spec/fixtures/product_spec_files/example.murano.spec.yaml +14 -0
  56. data/spec/fixtures/product_spec_files/gwe.exoline.spec.yaml +21 -0
  57. data/spec/fixtures/product_spec_files/gwe.murano.spec.yaml +16 -0
  58. data/spec/{lightbulb.yaml → fixtures/product_spec_files/lightbulb.yaml} +0 -0
  59. data/spec/spec_helper.rb +4 -4
  60. metadata +47 -19
@@ -1,4 +1,9 @@
1
+ require 'highline'
2
+ require 'yaml'
3
+ require 'json'
1
4
  require 'pp'
5
+ require 'csv'
6
+ require 'terminal-table'
2
7
 
3
8
  module MrMurano
4
9
  module Verbose
@@ -7,11 +12,77 @@ module MrMurano
7
12
  say msg
8
13
  end
9
14
  end
15
+
10
16
  def debug(msg)
11
17
  if $cfg['tool.debug'] then
12
18
  say msg
13
19
  end
14
20
  end
21
+
22
+ def warning(msg)
23
+ $stderr.puts HighLine.color(msg, :yellow)
24
+ end
25
+
26
+ def error(msg)
27
+ $stderr.puts HighLine.color(msg, :red)
28
+ end
29
+
30
+ def tabularize(data, ios=nil)
31
+ fmt = $cfg['tool.outformat']
32
+ ios = $stdout if ios.nil?
33
+ cols = []
34
+ rows = [[]]
35
+ title = nil
36
+ if data.kind_of?(Hash) then
37
+ cols = data[:headers] if data.has_key?(:headers)
38
+ rows = data[:rows] if data.has_key?(:rows)
39
+ title = data[:title]
40
+ elsif data.kind_of?(Array) then
41
+ rows = data
42
+ elsif data.respond_to?(:to_a) then
43
+ rows = data.to_a
44
+ elsif data.respond_to?(:each) then
45
+ rows = []
46
+ data.each{|i| rows << i}
47
+ else
48
+ error "Don't know how to tabularize data."
49
+ return
50
+ end
51
+ if fmt =~ /csv/i then
52
+ CSV(ios, :headers=>cols, :write_headers=>(not cols.empty?)) do |csv|
53
+ rows.each{|v| csv << v}
54
+ end
55
+ else
56
+ # table.
57
+ ios.puts Terminal::Table.new :title=>title, :headings=>cols, :rows=>rows
58
+ end
59
+ end
60
+
61
+ ## Format and print the object
62
+ def outf(obj, ios=nil, &block)
63
+ fmt = $cfg['tool.outformat']
64
+ ios = $stdout if ios.nil?
65
+ case fmt
66
+ when /yaml/i
67
+ ios.puts Hash.transform_keys_to_strings(obj).to_yaml
68
+ when /pp/
69
+ pp obj
70
+ when /json/i
71
+ ios.puts obj.to_json
72
+ else # aka best.
73
+ # sometime ‘best’ is only know by the caller, so block.
74
+ if block_given? then
75
+ yield obj, ios
76
+ else
77
+ if obj.kind_of?(Array) then
78
+ obj.each {|i| ios.puts i.to_s}
79
+ else
80
+ ios.puts obj.to_s
81
+ end
82
+ end
83
+ end
84
+ end
85
+
15
86
  end
16
87
  end
17
88
  # vim: set ai et sw=2 ts=2 :
@@ -1,4 +1,4 @@
1
1
  module MrMurano
2
- VERSION = '1.6.3'.freeze
2
+ VERSION = '1.7.0'.freeze
3
3
  end
4
4
 
data/lib/MrMurano.rb CHANGED
@@ -11,6 +11,7 @@ require 'MrMurano/Solution-Services'
11
11
  require 'MrMurano/Solution-Users'
12
12
  require 'MrMurano/Solution-ServiceConfig'
13
13
  require 'MrMurano/Product'
14
+ require 'MrMurano/Product-Resources'
14
15
 
15
16
  require 'MrMurano/commands'
16
17
 
@@ -20,7 +20,7 @@ RSpec.describe MrMurano::Config::ConfigFile do
20
20
  it ":internal does not write a file" do
21
21
  tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
22
22
  begin
23
- cf = MrMurano::Config::ConfigFile.new(:internal, tmpfile)
23
+ MrMurano::Config::ConfigFile.new(:internal, tmpfile)
24
24
  expect(FileTest.exist?(tmpfile)).to be(false)
25
25
  ensure
26
26
  File.unlink(tmpfile) if FileTest.exist?(tmpfile)
@@ -29,7 +29,7 @@ RSpec.describe MrMurano::Config::ConfigFile do
29
29
  it ":defaults does not write a file" do
30
30
  tmpfile = Dir.tmpdir + '/cfgtest' # This way because Tempfile.new creates.
31
31
  begin
32
- cf = MrMurano::Config::ConfigFile.new(:defaults, tmpfile)
32
+ MrMurano::Config::ConfigFile.new(:defaults, tmpfile)
33
33
  expect(FileTest.exist?(tmpfile)).to be(false)
34
34
  ensure
35
35
  File.unlink(tmpfile) if FileTest.exist?(tmpfile)
@@ -37,7 +37,7 @@ RSpec.describe MrMurano::Config::ConfigFile do
37
37
  end
38
38
 
39
39
  it "loads a file" do
40
- cf = MrMurano::Config::ConfigFile.new(:project, 'spec/testfiles/configfile')
40
+ cf = MrMurano::Config::ConfigFile.new(:project, 'spec/fixtures/configfile')
41
41
  cf.load
42
42
 
43
43
  expect(cf[:data]['solution']['id']).to eq('XXXXXXXXXX')
@@ -67,7 +67,7 @@ RSpec.describe MrMurano::ProductContent, "#product_content" do
67
67
  end
68
68
 
69
69
  it "uploads content data" do
70
- size = FileTest.size('spec/lightbulb.yaml')
70
+ size = FileTest.size('spec/fixtures/product_spec_files/lightbulb.yaml')
71
71
  stub_request(:post, @urlroot + "/testFor").
72
72
  with(headers: {'Authorization'=>'token TTTTTTTTTT',
73
73
  'Content-Type'=>'text/yaml',
@@ -75,7 +75,7 @@ RSpec.describe MrMurano::ProductContent, "#product_content" do
75
75
  }).
76
76
  to_return(status: 205)
77
77
 
78
- ret = @prd.upload('testFor', 'spec/lightbulb.yaml')
78
+ ret = @prd.upload('testFor', 'spec/fixtures/product_spec_files/lightbulb.yaml')
79
79
  expect(ret).to eq({})
80
80
  end
81
81
 
@@ -0,0 +1,152 @@
1
+ require 'MrMurano/version'
2
+ require 'MrMurano/Config'
3
+ require 'MrMurano/Product-Resources'
4
+
5
+ RSpec.describe MrMurano::ProductResources do
6
+ before(:example) do
7
+ $cfg = MrMurano::Config.new
8
+ $cfg.load
9
+ $cfg['net.host'] = 'bizapi.hosted.exosite.io'
10
+ $cfg['product.id'] = 'XYZ'
11
+
12
+ @prd = MrMurano::ProductResources.new
13
+ allow(@prd).to receive(:token).and_return("TTTTTTTTTT")
14
+ allow(@prd).to receive(:model_rid).and_return("LLLLLLLLLL")
15
+ end
16
+
17
+ it "initializes" do
18
+ uri = @prd.endPoint('')
19
+ expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process")
20
+ end
21
+
22
+ context "do_rpc" do
23
+ # Note, do_rpc is private.
24
+ it "Accepts an object" do
25
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
26
+ to_return(body: [{
27
+ :id=>1, :status=>"ok", :result=>{}
28
+ }])
29
+
30
+ ret = nil
31
+ @prd.instance_eval{ ret = do_rpc({:id=>1}) }
32
+ expect(ret).to eq({})
33
+ end
34
+
35
+ it "Accepts an Array" do
36
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
37
+ to_return(body: [{:id=>1, :status=>"ok", :result=>{:one=>1}},
38
+ {:id=>2, :status=>"ok", :result=>{:two=>2}}])
39
+
40
+ ret = nil
41
+ @prd.instance_eval{ ret = do_rpc([{:id=>1}, {:id=>2}]) }
42
+ expect(ret).to eq({:one=>1})
43
+ # yes it only returns first.
44
+ end
45
+
46
+ it "returns res if not Array" do
47
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
48
+ to_return(body: {:not=>'an array'}.to_json)
49
+
50
+ ret = nil
51
+ @prd.instance_eval{ ret = do_rpc({:id=>1}) }
52
+ expect(ret).to eq({:not=>'an array'})
53
+ end
54
+
55
+ it "returns res if count less than 1" do
56
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
57
+ to_return(body: [])
58
+
59
+ ret = nil
60
+ @prd.instance_eval{ ret = do_rpc({:id=>1}) }
61
+ expect(ret).to eq([])
62
+ end
63
+
64
+ it "returns res[0] if not Hash" do
65
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
66
+ to_return(body: ["foo"])
67
+
68
+ ret = nil
69
+ @prd.instance_eval{ ret = do_rpc({:id=>1}) }
70
+ expect(ret).to eq("foo")
71
+ end
72
+
73
+ it "returns res[0] if not status ok" do
74
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
75
+ to_return(body: [{:id=>1, :status=>'error'}])
76
+
77
+ ret = nil
78
+ @prd.instance_eval{ ret = do_rpc({:id=>1}) }
79
+ expect(ret).to eq({:id=>1, :status=>'error'})
80
+ end
81
+ end
82
+
83
+ context "queries" do
84
+ it "gets info" do
85
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
86
+ with(body: {:auth=>{:client_id=>"LLLLLLLLLL"},
87
+ :calls=>[{:id=>1,
88
+ :procedure=>"info",
89
+ :arguments=>["LLLLLLLLLL", {}]} ]}).
90
+ to_return(body: [{:id=>1, :status=>"ok", :result=>{:comments=>[]}}])
91
+
92
+ ret = @prd.info
93
+ expect(ret).to eq({:comments=>[]})
94
+ end
95
+
96
+ it "gets listing" do
97
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
98
+ with(body: {:auth=>{:client_id=>"LLLLLLLLLL"},
99
+ :calls=>[{:id=>1,
100
+ :procedure=>"info",
101
+ :arguments=>["LLLLLLLLLL", {}]} ]}).
102
+ to_return(body: [{:id=>1, :status=>"ok", :result=>{:aliases=>{:abcdefg=>["bob"]}}}])
103
+
104
+ ret = @prd.list
105
+ expect(ret).to eq([{:alias=>"bob", :rid=>:abcdefg}])
106
+ end
107
+ end
108
+
109
+ context "Modifying" do
110
+ it "Drops RID" do
111
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
112
+ with(body: {:auth=>{:client_id=>"LLLLLLLLLL"},
113
+ :calls=>[{:id=>1,
114
+ :procedure=>"drop",
115
+ :arguments=>["abcdefg"]} ]}).
116
+ to_return(body: [{:id=>1, :status=>"ok", :result=>{}}])
117
+
118
+ ret = @prd.remove("abcdefg")
119
+ expect(ret).to eq({})
120
+ end
121
+
122
+ it "Creates" do
123
+ frid = "ffffffffffffffffffffffffffffffffffffffff"
124
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
125
+ with(body: {:auth=>{:client_id=>"LLLLLLLLLL"},
126
+ :calls=>[{:id=>1,
127
+ :procedure=>"create",
128
+ :arguments=>["dataport",{
129
+ :format=>"string",
130
+ :name=>"bob",
131
+ :retention=>{
132
+ :count=>1,
133
+ :duration=>"infinity"
134
+ }
135
+ }]} ]}).
136
+ to_return(body: [{:id=>1, :status=>"ok", :result=>frid}])
137
+
138
+ stub_request(:post, "https://bizapi.hosted.exosite.io/api:1/product/XYZ/proxy/onep:v1/rpc/process").
139
+ with(body: {:auth=>{:client_id=>"LLLLLLLLLL"},
140
+ :calls=>[{:id=>1,
141
+ :procedure=>"map",
142
+ :arguments=>["alias", frid, "bob"]} ]}).
143
+ to_return(body: [{:id=>1, :status=>"ok", :result=>{}}])
144
+
145
+ ret = @prd.create("bob")
146
+ expect(ret).to eq({})
147
+ end
148
+ end
149
+
150
+ end
151
+
152
+ # vim: set ai et sw=2 ts=2 :
data/spec/Product_spec.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require 'MrMurano/version'
2
+ require 'MrMurano/Config'
2
3
  require 'MrMurano/Product'
3
4
 
4
5
  RSpec.describe MrMurano::Product, "#product" do
@@ -87,7 +88,7 @@ RSpec.describe MrMurano::Product, "#product" do
87
88
  to_return(body: rbody.to_json)
88
89
 
89
90
  # Open test file sepc.yaml
90
- ret = @prd.update('spec/lightbulb.yaml')
91
+ ret = @prd.update('spec/fixtures/product_spec_files/lightbulb.yaml')
91
92
  expect(ret).to eq(rbody)
92
93
  end
93
94
 
@@ -101,6 +102,42 @@ RSpec.describe MrMurano::Product, "#product" do
101
102
  expect(ret).to eq({:temp=> "ok", :humid=> "ok"})
102
103
  end
103
104
 
105
+ context "converting a specFile" do
106
+ it "can convert a file" do
107
+ out = @prd.convert('spec/fixtures/product_spec_files/gwe.exoline.spec.yaml')
108
+ want = IO.read('spec/fixtures/product_spec_files/gwe.murano.spec.yaml')
109
+
110
+ expect(out).to eq(want)
111
+ end
112
+
113
+ it "can convert stdin" do
114
+ File.open('spec/fixtures/product_spec_files/gwe.exoline.spec.yaml') do |fin|
115
+ begin
116
+ $stdin = fin
117
+ out = @prd.convert('-')
118
+ want = IO.read('spec/fixtures/product_spec_files/gwe.murano.spec.yaml')
119
+
120
+ expect(out).to eq(want)
121
+ ensure
122
+ $stdin = STDIN
123
+ end
124
+ end
125
+ end
126
+
127
+ it "converts a fully featured exoline spec file" do
128
+ out = @prd.convert('spec/fixtures/product_spec_files/example.exoline.spec.yaml')
129
+ want = IO.read('spec/fixtures/product_spec_files/example.murano.spec.yaml')
130
+
131
+ expect(out).to eq(want)
132
+ end
133
+
134
+ it "raises when not an exoline spec" do
135
+ expect {
136
+ @prd.convert('spec/fixtures/product_spec_files/example.murano.spec.yaml')
137
+ }.to raise_exception('No dataports section found, or not an array')
138
+ end
139
+ end
140
+
104
141
  end
105
142
 
106
143
  # vim: set ai et sw=2 ts=2 :
@@ -0,0 +1,134 @@
1
+ require 'MrMurano/version'
2
+ require 'MrMurano/Solution-Cors'
3
+ require 'tempfile'
4
+ require 'yaml'
5
+
6
+ RSpec.describe MrMurano::Cors do
7
+ before(:example) do
8
+ $cfg = MrMurano::Config.new
9
+ $cfg.load
10
+ $cfg['net.host'] = 'bizapi.hosted.exosite.io'
11
+ $cfg['solution.id'] = 'XYZ'
12
+
13
+ @srv = MrMurano::Cors.new
14
+ allow(@srv).to receive(:token).and_return("TTTTTTTTTT")
15
+ end
16
+
17
+ it "initializes" do
18
+ uri = @srv.endPoint('/')
19
+ expect(uri.to_s).to eq("https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors/")
20
+ end
21
+
22
+ it "lists" do
23
+ cors = {:origin=>true,
24
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
25
+ :headers=>["Content-Type","Cookie","Authorization"],
26
+ :credentials=>true}
27
+ body = {:cors=>cors.to_json}
28
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
29
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
30
+ 'Content-Type'=>'application/json'}).
31
+ to_return(body: body.to_json)
32
+
33
+ ret = @srv.list()
34
+ expect(ret).to eq([cors.merge({:id=>'cors'})])
35
+ end
36
+
37
+ context "fetches" do
38
+ it "as a hash" do
39
+ cors = {:origin=>true,
40
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
41
+ :headers=>["Content-Type","Cookie","Authorization"],
42
+ :credentials=>true}
43
+ body = {:cors=>cors.to_json}
44
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
45
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
46
+ 'Content-Type'=>'application/json'}).
47
+ to_return(body: body.to_json)
48
+
49
+ ret = @srv.fetch()
50
+ expect(ret).to eq(cors)
51
+ end
52
+ it "as a block" do
53
+ cors = {:origin=>true,
54
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
55
+ :headers=>["Content-Type","Cookie","Authorization"],
56
+ :credentials=>true}
57
+ body = {:cors=>cors.to_json}
58
+ stub_request(:get, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
59
+ with(:headers=>{'Authorization'=>'token TTTTTTTTTT',
60
+ 'Content-Type'=>'application/json'}).
61
+ to_return(body: body.to_json)
62
+
63
+ ret = ''
64
+ loops = 0
65
+ @srv.fetch() do |chunk|
66
+ loops += 1
67
+ ret << chunk
68
+ expect(loops).to be <= 1
69
+ end
70
+ expect(ret).to eq(Hash.transform_keys_to_strings(cors).to_yaml)
71
+ end
72
+ end
73
+
74
+ it "remove is a nop" do
75
+ ret = @srv.remove('9K0')
76
+ expect(ret).to eq(nil)
77
+ end
78
+
79
+ it "uploads over old version" do
80
+ cors = {:origin=>true,
81
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
82
+ :headers=>["Content-Type","Cookie","Authorization"],
83
+ :credentials=>true}
84
+ stub_request(:put, "https://bizapi.hosted.exosite.io/api:1/solution/XYZ/cors").
85
+ with(:body=>cors.to_json,
86
+ :headers=>{'Authorization'=>'token TTTTTTTTTT',
87
+ 'Content-Type'=>'application/json'}).
88
+ to_return(body: "")
89
+
90
+ ret = @srv.upload(nil, cors)
91
+ expect(ret)
92
+ end
93
+
94
+ context "finding cors.yaml" do
95
+ it "return empty if missing" do
96
+ allow(@srv).to receive(:warning)
97
+ ret = @srv.localitems('cors.yaml')
98
+ expect(ret).to eq([])
99
+ end
100
+
101
+ it "return empty if not a file" do
102
+ Dir.tmpdir do |td|
103
+ tp = File.join(td, 'cors.yaml')
104
+ Dir.mkdir( tp ) # not a file
105
+ allow(@srv).to receive(:warning)
106
+ ret = @srv.localitems(tp)
107
+ expect(ret).to eq([])
108
+ end
109
+ end
110
+
111
+ it "return contents" do
112
+ cors = {:origin=>true,
113
+ :methods=>["HEAD","GET","POST","PUT","DELETE","OPTIONS","PATCH"],
114
+ :headers=>["Content-Type","Cookie","Authorization"],
115
+ :credentials=>true}
116
+
117
+ Tempfile.open('cors.yaml') do |tio|
118
+ tio << Hash.transform_keys_to_strings(cors).to_yaml
119
+ tio.close
120
+
121
+ ret = @srv.localitems(tio.path)
122
+ expect(ret).to eq([cors.merge({:id=>'cors'})])
123
+ end
124
+ end
125
+
126
+ end
127
+
128
+ it "removelocal is a nop" do
129
+ ret = @srv.removelocal('a/path/', {:id=>'cors'})
130
+ expect(ret).to eq(nil)
131
+ end
132
+
133
+ end
134
+ # vim: set ai et sw=2 ts=2 :