summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2014-08-20 11:53:28 -0700
committerJohn Keiser <jkeiser@opscode.com>2014-08-22 09:20:50 -0700
commit1d24016c8033d4839b3ff07a324672f434868538 (patch)
tree07498560d03dbfdb4099c5fa1c24f9e32af02f8b
parent21d87873e784f97aad21d92eeef9b3a059e16b67 (diff)
downloadchef-zero-1d24016c8033d4839b3ff07a324672f434868538.tar.gz
Get organization endpoint passing oc-chef-pedant
-rw-r--r--lib/chef_zero/endpoints/organization_endpoint.rb6
-rw-r--r--lib/chef_zero/endpoints/organizations_endpoint.rb2
-rw-r--r--spec/run_oc_pedant.rb4
3 files changed, 9 insertions, 3 deletions
diff --git a/lib/chef_zero/endpoints/organization_endpoint.rb b/lib/chef_zero/endpoints/organization_endpoint.rb
index 554982f..b33b105 100644
--- a/lib/chef_zero/endpoints/organization_endpoint.rb
+++ b/lib/chef_zero/endpoints/organization_endpoint.rb
@@ -17,8 +17,12 @@ module ChefZero
org[key] = value
end
org = JSON.pretty_generate(org)
+ if new_org['name'] != request.rest_path[-1]
+ # This is a rename
+ return error(400, "Cannot rename org #{request.rest_path[-1]} to #{new_org['name']}: rename not supported for orgs")
+ end
set_data(request, request.rest_path + [ 'org' ], org)
- already_json_response(200, populate_defaults(request, org))
+ json_response(200, "uri" => "#{build_uri(request.base_uri, request.rest_path)}")
end
def delete(request)
diff --git a/lib/chef_zero/endpoints/organizations_endpoint.rb b/lib/chef_zero/endpoints/organizations_endpoint.rb
index 1609a6b..835faf9 100644
--- a/lib/chef_zero/endpoints/organizations_endpoint.rb
+++ b/lib/chef_zero/endpoints/organizations_endpoint.rb
@@ -25,7 +25,7 @@ module ChefZero
create_data_dir(request, request.rest_path, name, :requestor => request.requestor)
org = {
- "guid" => UUIDTools::UUID.random_create,
+ "guid" => UUIDTools::UUID.random_create.to_s.gsub('-', ''),
"assigned_at" => Time.now.to_s
}
org_path = request.rest_path + [ name ]
diff --git a/spec/run_oc_pedant.rb b/spec/run_oc_pedant.rb
index c0cc01e..562bf6a 100644
--- a/spec/run_oc_pedant.rb
+++ b/spec/run_oc_pedant.rb
@@ -38,7 +38,9 @@ begin
'--skip-authentication',
'--skip-authorization',
'--skip-omnibus',
- '--skip-usags'
+ '--skip-usags',
+ '--skip-internal_orgs',
+ '--skip-rename_org'
])
result = RSpec::Core::Runner.run(Pedant.config.rspec_args)