spice 1.0.0.rc → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. data/.gitignore +2 -0
  2. data/Gemfile +0 -14
  3. data/README.md +1 -1
  4. data/Rakefile +1 -1
  5. data/TODO.md +2 -1
  6. data/lib/spice.rb +47 -72
  7. data/lib/spice/authentication.rb +23 -45
  8. data/lib/spice/base.rb +104 -0
  9. data/lib/spice/client.rb +8 -48
  10. data/lib/spice/config.rb +37 -19
  11. data/lib/spice/connection.rb +33 -117
  12. data/lib/spice/connection/clients.rb +26 -6
  13. data/lib/spice/connection/cookbooks.rb +19 -14
  14. data/lib/spice/connection/data_bags.rb +31 -20
  15. data/lib/spice/connection/environments.rb +6 -7
  16. data/lib/spice/connection/nodes.rb +23 -6
  17. data/lib/spice/connection/roles.rb +5 -5
  18. data/lib/spice/connection/search.rb +12 -12
  19. data/lib/spice/cookbook.rb +3 -29
  20. data/lib/spice/cookbook_version.rb +9 -61
  21. data/lib/spice/core_ext/array.rb +7 -0
  22. data/lib/spice/core_ext/enumerable.rb +11 -0
  23. data/lib/spice/core_ext/hash.rb +49 -0
  24. data/lib/spice/core_ext/mash.rb +219 -0
  25. data/lib/spice/data_bag.rb +3 -37
  26. data/lib/spice/data_bag_item.rb +7 -47
  27. data/lib/spice/environment.rb +12 -27
  28. data/lib/spice/error.rb +22 -10
  29. data/lib/spice/identity_map.rb +8 -0
  30. data/lib/spice/node.rb +13 -34
  31. data/lib/spice/request.rb +73 -11
  32. data/lib/spice/response/parse_json.rb +8 -3
  33. data/lib/spice/role.rb +8 -33
  34. data/lib/spice/version.rb +1 -1
  35. data/spec/fixtures/client.pem +27 -0
  36. data/spec/fixtures/clients/create.json +4 -0
  37. data/spec/fixtures/clients/index.json +5 -0
  38. data/spec/fixtures/clients/reregister.json +5 -0
  39. data/spec/fixtures/clients/show.json +8 -0
  40. data/spec/fixtures/clients/update.json +5 -0
  41. data/spec/fixtures/cookbook_versions/show.json +108 -0
  42. data/spec/fixtures/cookbook_versions/update.json +62 -0
  43. data/spec/fixtures/cookbooks/index-0.10.json +28 -0
  44. data/spec/fixtures/cookbooks/index-0.9.json +4 -0
  45. data/spec/fixtures/cookbooks/show-0.10.json +15 -0
  46. data/spec/fixtures/cookbooks/show-apache2-0.9.json +5 -0
  47. data/spec/fixtures/cookbooks/show-unicorn-0.9.json +5 -0
  48. data/spec/fixtures/data_bag_items/create.json +1 -0
  49. data/spec/fixtures/data_bag_items/show.json +4 -0
  50. data/spec/fixtures/data_bag_items/update.json +4 -0
  51. data/spec/fixtures/data_bags/create.json +3 -0
  52. data/spec/fixtures/data_bags/index.json +3 -0
  53. data/spec/fixtures/data_bags/show.json +3 -0
  54. data/spec/fixtures/environments/cookbook.json +15 -0
  55. data/spec/fixtures/environments/cookbooks.json +28 -0
  56. data/spec/fixtures/environments/create.json +1 -0
  57. data/spec/fixtures/environments/delete.json +8 -0
  58. data/spec/fixtures/environments/index.json +3 -0
  59. data/spec/fixtures/environments/show.json +8 -0
  60. data/spec/fixtures/environments/update.json +8 -0
  61. data/spec/fixtures/nodes/cookbooks.json +41 -0
  62. data/spec/fixtures/nodes/create.json +1 -0
  63. data/spec/fixtures/nodes/delete.json +17 -0
  64. data/spec/fixtures/nodes/index.json +3 -0
  65. data/spec/fixtures/nodes/show.json +17 -0
  66. data/spec/fixtures/nodes/update.json +13 -0
  67. data/spec/fixtures/roles/create.json +1 -0
  68. data/spec/fixtures/roles/delete.json +11 -0
  69. data/spec/fixtures/roles/index.json +3 -0
  70. data/spec/fixtures/roles/show.json +12 -0
  71. data/spec/fixtures/roles/update.json +11 -0
  72. data/spec/fixtures/search/client.json +1 -0
  73. data/spec/fixtures/search/data_bag.json +1 -0
  74. data/spec/fixtures/search/environment.json +1 -0
  75. data/spec/fixtures/search/node.json +1 -0
  76. data/spec/fixtures/search/role.json +1 -0
  77. data/spec/spec_helper.rb +5 -4
  78. data/spec/spice/base_spec.rb +34 -0
  79. data/spec/spice/client_spec.rb +0 -61
  80. data/spec/spice/config_spec.rb +14 -0
  81. data/spec/spice/connection/clients_spec.rb +82 -0
  82. data/spec/spice/connection/cookbooks_spec.rb +86 -0
  83. data/spec/spice/connection/data_bags_spec.rb +126 -0
  84. data/spec/spice/connection_spec.rb +63 -0
  85. data/spec/spice/cookbook_spec.rb +0 -61
  86. data/spec/spice/data_bag_item_spec.rb +7 -0
  87. data/spec/spice/data_bag_spec.rb +0 -160
  88. data/spec/spice/environment_spec.rb +0 -89
  89. data/spec/spice/node_spec.rb +0 -74
  90. data/spec/spice/role_spec.rb +0 -61
  91. data/spec/spice_spec.rb +8 -116
  92. data/spec/support/helpers.rb +58 -0
  93. data/spice.gemspec +13 -15
  94. metadata +227 -87
  95. data/.watchr +0 -22
  96. data/lib/spice/connection/authentication.rb +0 -47
  97. data/lib/spice/mock.rb +0 -46
  98. data/lib/spice/persistence.rb +0 -62
  99. data/spec/spice/chef_spec.rb +0 -52
  100. data/spec/spice/search_spec.rb +0 -2
  101. data/spec/support/chef_requests.rb +0 -0
  102. data/spec/support/client_requests.rb +0 -95
  103. data/spec/support/cookbook_requests.rb +0 -95
  104. data/spec/support/data_bag_item_requests.rb +0 -138
  105. data/spec/support/data_bag_requests.rb +0 -95
  106. data/spec/support/environment_requests.rb +0 -221
  107. data/spec/support/node_requests.rb +0 -138
  108. data/spec/support/respond_with_matcher.rb +0 -53
  109. data/spec/support/role_requests.rb +0 -95
data/.watchr DELETED
@@ -1,22 +0,0 @@
1
- def run_spec(file)
2
- unless File.exist?(file)
3
- puts "#{file} does not exist"
4
- return
5
- end
6
-
7
- puts "Running #{file}"
8
- system "bundle exec rspec #{file}"
9
- puts
10
- end
11
-
12
- watch("spec/.*/*_spec\.rb") do |match|
13
- run_spec match[0]
14
- end
15
-
16
- watch("lib/(.*/.*)\.rb") do |match|
17
- run_spec %{spec/#{match[1]}_spec.rb}
18
- end
19
-
20
- watch("lib/spice.rb") do |match|
21
- run_spec %{spec/spice_spec.rb}
22
- end
@@ -1,47 +0,0 @@
1
- module Spice
2
- class Connection
3
- module Authentication
4
-
5
- def sign_requests?
6
- !!key_file
7
- end
8
-
9
- def signature_headers(request_params={})
10
- load_signing_key if sign_requests?
11
- request_params = request_params.dup
12
- request_params[:timestamp] = Time.now.utc.iso8601
13
- request_params[:user_id] = client_name
14
- host = request_params.delete(:host) || "localhost"
15
-
16
- sign_obj = Mixlib::Authentication::SignedHeaderAuth.signing_object(request_params)
17
- signed = sign_obj.sign(@key).merge({:host => host})
18
- signed.inject({}){|memo, kv| memo["#{kv[0].to_s.upcase}"] = kv[1];memo}
19
- # Platform requires X-Chef-Version header
20
- version = { "X-Chef-Version" => Spice.chef_version }
21
- signed.merge!(version)
22
- end
23
-
24
- private
25
-
26
- def load_signing_key
27
- begin
28
- raw_key = File.read(key_file).strip
29
- rescue SystemCallError, IOError => e
30
- raise IOError, "Unable to read #{key_file}"
31
- end
32
- assert_valid_key_format!(raw_key)
33
- @key = OpenSSL::PKey::RSA.new(raw_key)
34
- end
35
-
36
- def assert_valid_key_format!(raw_key)
37
- unless (raw_key =~ /\A-----BEGIN RSA PRIVATE KEY-----$/) &&
38
- (raw_key =~ /^-----END RSA PRIVATE KEY-----\Z/)
39
- msg = "The file #{key_file} does not contain a correctly formatted private key.\n"
40
- msg << "The key file should begin with '-----BEGIN RSA PRIVATE KEY-----' and end with '-----END RSA PRIVATE KEY-----'"
41
- raise ArgumentError, msg
42
- end
43
- end
44
-
45
- end
46
- end
47
- end
@@ -1,46 +0,0 @@
1
- module Spice
2
- class Mock
3
- class << self
4
- def setup_mock_client
5
- self.setup_authentication
6
- Spice.server_url = 'http://localhost:4000'
7
- Spice.client_name = "testclient"
8
- Spice.key_file = "/tmp/keyfile.pem"
9
- Spice.chef_version = "0.10.4"
10
- Spice.connect!
11
- end
12
-
13
- def setup_authentication
14
- File.open("/tmp/keyfile.pem","w+") do |f|
15
- f.write(%Q{-----BEGIN RSA PRIVATE KEY-----
16
- MIIEowIBAAKCAQEAqd1K3siOLkxiU0B98QzP+qbT3uPaCIGGR+EAO8mXMpTUNfPv
17
- Kr4NeIV8kqfrngghYF3Y2Ky0e3Ifl3b7UQTfrSofmyoC/EBBA4dH2ygUoYtP0aIi
18
- sdxnSpYhX9PXavZ4POkDuO3SKRUEuC71OzIQQ3GijXA8L1JRBTOb0QiC7vBSuwaM
19
- 15qAqW4FGs7jYyG909AERY3AQTmZZ8TsAY07fqv4BC8a6965dzBp3GD5KY/IuRlN
20
- hoqp1xQdqZ8C0nNk6akWoia9/NMs4rULpuiPSeVOSDX0iGcOMFG6Ur5ihBl8S+Dy
21
- 96QpNU3Xx/puhALbGxPkoyELwmhuZRmpMo3YDQIDAQABAoIBABYifAsj30MxOO7Y
22
- TJEItmFXM+yrjFHnbvQW4czorAcvVafiLZxIP8Egw+bocs+ZB6BjGkrB1pLvgCZg
23
- nscj93G9N3kktFbimJY5Hqf0RRv352LN2e+LZPpXLeoq1LtferOVOaLzeptX3dGS
24
- bOpVz8C6IhCEO5N/Coe+/eLzVPyFpibhlNpQPPUbPP8mpL2d0oro4GHcO0lcdm0t
25
- 5iAs7drwOcA97dntBZFwMj5tA0d6ujgc88lS3eNqZAx5TsOKh+yetNMpO+GJlXFO
26
- koiJ4ZF6Fx6/5R+iX+ejtebA3GPdPAHSMxmVUGWDOeRTdpsqsEyDXsLADb1FTVnk
27
- B4WPvRECgYEA1GkyU2CUw3kcKAQrxfmGdDuTbwSG7/Np9nCie57PDE16CQd6BP5H
28
- cRbOoC10/h2gJmaqODV7PJmeimOd5C74xiLfZ8TZvg+nv2NOwbGMLbU9PiZcjda9
29
- YEVmya6UpMBZdD73yir5PUPHiws3Xx0+8CKpD/nfDhfOVPTIzrJyDMMCgYEAzLj0
30
- 2NLWhI17KxNpFV76XlEHmwwhKKCN0HsFj/qSmPQZsRn5Xph9wgH2ey+ag12IOVGe
31
- kbYPz1/74uzfkZpye4ysn1cvDUXbPbAzdBJ8VT/kmQpB1+ZRFRi7xUf+AEp54932
32
- FObLehFPo+w0SKNHeJqKY0k/k/0/AwpapLwVeu8CgYEAh8nYSkTr1SqPPWWtNhqW
33
- Qaf0UHxsZukNTGYk+TJE2nCNG0iUUKzdrwYNgYiNygXWY7YuC1DlP5BVMdMNFNqS
34
- XtfcSdImAMKxUkCCEIEYRAAg7qJHeMVWuzyiwTvB+rCcfxvh/HQMcYXrApBhDYT8
35
- vzbpLTVnyvKdDOKPnNOm5VECgYBajhGX+yLyfRaXRj28O0fqAlOn7KSaMPKp3lDm
36
- kALab1cR9JhOlItEDtQ1RyhEpVHFcOoAMBUsOJvVk8uMv1GWfvI4hTsF1vmUfuUz
37
- mZ2vo9R9MYFQe8sv1sHwENk0zby+44afVjt5IkElFC1IWBkcKte99T+POXzu3lyb
38
- 86pYtwKBgEaeHGw4mSbnz6aecPbshGYrV3CkPRO9z6nAiC6lp6a0PYJAPNDrvqdg
39
- 5h0uCkb5FfgWIOq2tCUYY/ZrSglE17wPmd8iRAN7wb+prKAHOh+o4P0k1EtviNdU
40
- 8JgshucQzoeIygNfo2QG3vfsfA/4V9aa/yb/bqHPsJHBgnuSVjv+
41
- -----END RSA PRIVATE KEY-----})
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,62 +0,0 @@
1
- module Spice
2
- module Persistence
3
- def self.included(base)
4
- base.extend ActiveModel::Callbacks
5
- base.send(:define_model_callbacks, :create, :update, :destroy)
6
- base.send(:after_create, :do_post)
7
- base.send(:after_update, :do_put)
8
- base.send(:after_destroy, :do_delete)
9
- end
10
-
11
- def create
12
- run_callbacks :create do
13
- end
14
- end
15
-
16
- def update
17
- run_callbacks :update do
18
- end
19
- end
20
-
21
- def destroy
22
- run_callbacks :destroy do
23
- end
24
- end
25
-
26
- def endpoint(ep=nil)
27
- @endpoint = ep if !ep.nil?
28
- @endpoint
29
- end
30
-
31
- def all(options={})
32
- connection.send(endpoint, options)
33
- end
34
-
35
- def get(options)
36
- connection.send(endpoint, options).first
37
- end
38
-
39
- def connection
40
- Spice.connection
41
- end
42
-
43
- def do_post
44
- response = connection.post("/#{self.class.endpoint}", attributes)
45
- update_attributes(response.body)
46
- response = connection.get("/#{self.class.endpoint}/#{name}")
47
- update_attributes(response.body)
48
- end
49
-
50
- def do_put
51
- connection.put("/#{self.class.endpoint}/#{name}", attributes)
52
- end
53
-
54
- def do_delete
55
- connection.delete("/#{self.class.endpoint}/#{name}")
56
- end
57
-
58
- def new_record?
59
- raise NotImplementedError, "Override this method in the class that includes this module."
60
- end
61
- end
62
- end
@@ -1,52 +0,0 @@
1
- require 'spec_helper'
2
-
3
- module Spice
4
- describe Chef do
5
- describe '.connection' do
6
- it "returns an instance of Spice::Connection" do
7
- Spice::Chef.connection.should be_an_instance_of(Spice::Connection)
8
- end
9
- end
10
-
11
- describe ".clients" do
12
- before { stub_client_list }
13
- subject { Chef.clients }
14
-
15
- it { should have_body(client_list_response) }
16
- it { should respond_with(200) }
17
- end
18
-
19
- describe ".cookbooks" do
20
- before { stub_cookbook_list }
21
- subject { Chef.cookbooks }
22
-
23
- it { should have_body(cookbook_list_response) }
24
- it { should respond_with(200) }
25
- end
26
-
27
- describe ".data_bags" do
28
- before { stub_data_bag_list }
29
- subject { Chef.data_bags }
30
-
31
- it { should have_body(data_bag_list_response) }
32
- it { should respond_with(200) }
33
- end
34
-
35
- describe ".nodes" do
36
- before { stub_node_list }
37
- subject { Chef.nodes }
38
-
39
- it { should have_body(node_list_response) }
40
- it { should respond_with(200) }
41
- end
42
-
43
- describe ".roles" do
44
- before { stub_role_list }
45
- subject { Chef.roles }
46
-
47
- it { should have_body(role_list_response) }
48
- it { should respond_with(200) }
49
- end
50
-
51
- end
52
- end
@@ -1,2 +0,0 @@
1
- require 'spec_helper'
2
-
File without changes
@@ -1,95 +0,0 @@
1
- def stub_client_list
2
- stub_request(:get, "http://localhost:4000/clients").
3
- to_return(
4
- :status => 200,
5
- :body => client_list_response
6
- )
7
- end
8
-
9
- def stub_client_show(status=200)
10
- case status
11
- when 200
12
- stub_request(:get, "http://localhost:4000/clients/testclient").
13
- to_return(
14
- :status => status,
15
- :body => client_show_response
16
- )
17
- when 404
18
- stub_request(:get, "http://localhost:4000/clients/testclient").
19
- to_return(
20
- :status => status,
21
- :body => client_not_found
22
- )
23
- end
24
- end
25
-
26
- def stub_client_create(status=201)
27
- case status
28
- when 201
29
- stub_request(:post, "http://localhost:4000/clients").
30
- with(
31
- :body => client_create_payload ).
32
- to_return(
33
- :status => status,
34
- :body => client_create_response
35
- )
36
- when 409
37
- stub_request(:post, "http://localhost:4000/clients").
38
- with(
39
- :body => client_create_payload ).
40
- to_return(
41
- :status => status,
42
- :body => client_conflict
43
- )
44
- end
45
- end
46
-
47
- def stub_client_delete(status=200)
48
- case status
49
- when 200
50
- stub_request(:delete, "http://localhost:4000/clients/testclient").
51
- with(:body => "").
52
- to_return(
53
- :status => status,
54
- :body => client_delete_response
55
- )
56
- when 404
57
- stub_request(:delete, "http://localhost:4000/clients/testclient").
58
- with(:body => "").
59
- to_return(
60
- :status => status,
61
- :body => client_not_found
62
- )
63
- end
64
- end
65
-
66
- # payloads and responses
67
-
68
- def client_list_response
69
- { "testclient" => "http://localhost:4000/clients/testclient" }
70
- end
71
-
72
- def client_show_response
73
- { "adam" => "http://localhost:4000/clients/testclient" }
74
- end
75
-
76
- def client_delete_response
77
- { "name" => "users", "json_class" => "Chef::Client", "chef_type" => "client" }
78
- end
79
-
80
- def client_not_found
81
- { "error" => [ "Could not load client testclient" ] }
82
- end
83
-
84
- def client_conflict
85
- { "error" => [ "Client already exists" ] }
86
- end
87
-
88
- def client_create_payload
89
- { "name" => "testclient" }
90
- end
91
-
92
- def client_create_response
93
- { "private_key"=>"-----BEGIN RSA PRIVATE KEY-----",
94
- "uri"=>"http://localhost:4000/clients/testclient" }
95
- end
@@ -1,95 +0,0 @@
1
- def stub_cookbook_list
2
- stub_request(:get, "http://localhost:4000/cookbooks").
3
- to_return(
4
- :status => 200,
5
- :body => cookbook_list_response
6
- )
7
- end
8
-
9
- def stub_cookbook_show(status=200)
10
- case status
11
- when 200
12
- stub_request(:get, "http://localhost:4000/cookbooks/testcookbook").
13
- to_return(
14
- :status => status,
15
- :body => cookbook_show_response
16
- )
17
- when 404
18
- stub_request(:get, "http://localhost:4000/cookbooks/testcookbook").
19
- to_return(
20
- :status => status,
21
- :body => cookbook_not_found
22
- )
23
- end
24
- end
25
-
26
- def stub_cookbook_create(status=201)
27
- case status
28
- when 201
29
- stub_request(:post, "http://localhost:4000/cookbooks").
30
- with(
31
- :body => cookbook_create_payload ).
32
- to_return(
33
- :status => status,
34
- :body => cookbook_create_response
35
- )
36
- when 409
37
- stub_request(:post, "http://localhost:4000/cookbooks").
38
- with(
39
- :body => cookbook_create_payload ).
40
- to_return(
41
- :status => status,
42
- :body => cookbook_conflict
43
- )
44
- end
45
- end
46
-
47
- def stub_cookbook_delete(status=200)
48
- case status
49
- when 200
50
- stub_request(:delete, "http://localhost:4000/cookbooks/testcookbook").
51
- with(:body => "").
52
- to_return(
53
- :status => status,
54
- :body => cookbook_delete_response
55
- )
56
- when 404
57
- stub_request(:delete, "http://localhost:4000/cookbooks/testcookbook").
58
- with(:body => "").
59
- to_return(
60
- :status => status,
61
- :body => cookbook_not_found
62
- )
63
- end
64
- end
65
-
66
- # payloads and responses
67
-
68
- def cookbook_list_response
69
- { "testcookbook" => "http://localhost:4000/cookbooks/testcookbook" }
70
- end
71
-
72
- def cookbook_show_response
73
- { "adam" => "http://localhost:4000/cookbooks/testcookbook" }
74
- end
75
-
76
- def cookbook_delete_response
77
- { "name" => "users", "json_class" => "Chef::Cookbook", "chef_type" => "cookbook" }
78
- end
79
-
80
- def cookbook_not_found
81
- { "error" => [ "Could not load cookbook testcookbook" ] }
82
- end
83
-
84
- def cookbook_conflict
85
- { "error" => [ "Cookbook already exists" ] }
86
- end
87
-
88
- def cookbook_create_payload
89
- { "name" => "testcookbook" }
90
- end
91
-
92
- def cookbook_create_response
93
- { "private_key"=>"-----BEGIN RSA PRIVATE KEY-----",
94
- "uri"=>"http://localhost:4000/cookbooks/testcookbook" }
95
- end
@@ -1,138 +0,0 @@
1
- def stub_data_bag_item_show(status=200)
2
- case status
3
- when 200
4
- stub_request(:get, "http://localhost:4000/data/users/adam").
5
- to_return(
6
- :status => status,
7
- :body => data_bag_item_show_response
8
- )
9
- when 404
10
- stub_request(:get, "http://localhost:4000/data/users/adam").
11
- to_return(
12
- :status => status,
13
- :body => data_bag_item_not_found
14
- )
15
- end
16
- end
17
-
18
-
19
- def stub_data_bag_item_create(status=201)
20
- case status
21
- when 201
22
- stub_request(:post, "http://localhost:4000/data/users").
23
- with(
24
- :body => data_bag_item_create_payload ).
25
- to_return(
26
- :status => status,
27
- :body => data_bag_item_create_response
28
- )
29
- when 409
30
- stub_request(:post, "http://localhost:4000/data/users").
31
- with(
32
- :body => data_bag_item_create_payload ).
33
- to_return(
34
- :status => status,
35
- :body => data_bag_item_conflict
36
- )
37
- when 404
38
- stub_request(:post, "http://localhost:4000/data/users").
39
- with(
40
- :body => data_bag_item_create_payload ).
41
- to_return(
42
- :status => status,
43
- :body => data_bag_not_found
44
- )
45
- end
46
- end
47
-
48
- def stub_data_bag_item_update(status=200)
49
- case status
50
- when 200
51
- stub_request(:put, "http://localhost:4000/data/users/adam").
52
- with(
53
- :body => data_bag_item_update_payload ).
54
- to_return(
55
- :status => status,
56
- :body => data_bag_item_update_response
57
- )
58
- when 404
59
- stub_request(:put, "http://localhost:4000/data/users/adam").
60
- with(
61
- :body => data_bag_item_update_payload ).
62
- to_return(
63
- :status => status,
64
- :body => data_bag_item_not_found
65
- )
66
- end
67
- end
68
-
69
- def stub_data_bag_item_delete(status=200)
70
- case status
71
- when 200
72
- stub_request(:delete, "http://localhost:4000/data/users/adam").
73
- with(:body => "").
74
- to_return(
75
- :status => status,
76
- :body => data_bag_item_delete_response
77
- )
78
- when 404
79
- stub_request(:delete, "http://localhost:4000/data/users/adam").
80
- with(:body => "").
81
- to_return(
82
- :status => status,
83
- :body => data_bag_item_not_found
84
- )
85
- end
86
- end
87
-
88
- def data_bag_item_create_payload
89
- { "id" => "adam", "real_name" => "Adam Jacob" }
90
- end
91
-
92
- def data_bag_item_create_response
93
- { "id" => "adam",
94
- "data_bag" => "users",
95
- "chef_type" => "data_bag_item",
96
- "real_name" => "Adam Jacob" }
97
- end
98
-
99
- def data_bag_item_show_response
100
- { "name" => "users", "id" => "adam" }
101
- end
102
-
103
- def data_bag_item_update_payload
104
- { "title" => "Supreme Awesomer" }
105
- end
106
-
107
- def data_bag_item_update_response
108
- {
109
- "_rev" => "2-0f58b834949ce8a8b5f713bf8a525de7",
110
- "title" => "Supreme Awesomer",
111
- "id" => "adam",
112
- "data_bag" => "users",
113
- "chef_type" => "data_bag_item"
114
- }
115
- end
116
-
117
- def data_bag_item_delete_response
118
- { "name" => "data_bag_item_users_adam",
119
- "raw_data" => {
120
- "id" => "adam"
121
- },
122
- "json_class" => "Chef::DataBagItem",
123
- "data_bag" => "users",
124
- "chef_type" => "data_bag_item"
125
- }
126
- end
127
-
128
- def data_bag_item_not_found
129
- { "error" => [ "Cannot load data bag users item adam" ] }
130
- end
131
-
132
- def data_bag_item_conflict
133
- { "error" => [ "Databag Item adam already exists" ] }
134
- end
135
-
136
- def data_bag_item_show_response
137
- { "real_name" => "Adam Jacob", "id" => "adam" }
138
- end