summaryrefslogtreecommitdiff
path: root/spec/integration/knife/chef_fs_data_store_spec.rb
diff options
context:
space:
mode:
authorJohn Keiser <jkeiser@opscode.com>2013-10-11 16:10:02 -0700
committerJohn Keiser <jkeiser@opscode.com>2013-10-11 16:10:02 -0700
commit6468f28792cae068c49908de7cc7177bb6c6ad28 (patch)
treea464eb3986bad3d3756cb9fec57a16fce71a520c /spec/integration/knife/chef_fs_data_store_spec.rb
parent1faa25b310a870c1457ba9c4499a7e08c24ead51 (diff)
downloadchef-6468f28792cae068c49908de7cc7177bb6c6ad28.tar.gz
Add failure tests for -z
Diffstat (limited to 'spec/integration/knife/chef_fs_data_store_spec.rb')
-rw-r--r--spec/integration/knife/chef_fs_data_store_spec.rb104
1 files changed, 104 insertions, 0 deletions
diff --git a/spec/integration/knife/chef_fs_data_store_spec.rb b/spec/integration/knife/chef_fs_data_store_spec.rb
index bc18847118..72c9f3f045 100644
--- a/spec/integration/knife/chef_fs_data_store_spec.rb
+++ b/spec/integration/knife/chef_fs_data_store_spec.rb
@@ -223,5 +223,109 @@ EOM
knife('list --local /users').should_succeed "/users/z.json\n"
end
end
+
+ it 'knife list -z -R returns nothing' do
+ knife('list -z -Rfp /').should_succeed <<EOM
+/clients/
+/cookbooks/
+/data_bags/
+/environments/
+/nodes/
+/roles/
+/users/
+EOM
+ end
+
+ context 'DELETE /TYPE/NAME' do
+ it 'knife delete -z /clients/x.json fails with an error' do
+ knife('delete -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ end
+
+ it 'knife delete -z -r /cookbooks/x fails with an error' do
+ knife('delete -z -r /cookbooks/x').should_fail "ERROR: /cookbooks/x: No such file or directory\n"
+ end
+
+ it 'knife delete -z -r /data_bags/x fails with an error' do
+ knife('delete -z -r /data_bags/x').should_fail "ERROR: /data_bags/x: No such file or directory\n"
+ end
+
+ it 'knife delete -z /data_bags/x/y.json fails with an error' do
+ knife('delete -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ end
+
+ it 'knife delete -z /environments/x.json fails with an error' do
+ knife('delete -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ end
+
+ it 'knife delete -z /nodes/x.json fails with an error' do
+ knife('delete -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ end
+
+ it 'knife delete -z /roles/x.json fails with an error' do
+ knife('delete -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ end
+
+ it 'knife delete -z /users/x.json fails with an error' do
+ knife('delete -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ end
+ end
+
+ context 'GET /TYPE/NAME' do
+ it 'knife show -z /clients/x.json fails with an error' do
+ knife('show -z /clients/x.json').should_fail "ERROR: /clients/x.json: No such file or directory\n"
+ end
+
+ it 'knife show -z /cookbooks/x/metadata.rb fails with an error' do
+ knife('show -z /cookbooks/x/metadata.rb').should_fail "ERROR: /cookbooks/x/metadata.rb: No such file or directory\n"
+ end
+
+ it 'knife show -z /data_bags/x/y.json fails with an error' do
+ knife('show -z /data_bags/x/y.json').should_fail "ERROR: /data_bags/x/y.json: No such file or directory\n"
+ end
+
+ it 'knife show -z /environments/x.json fails with an error' do
+ knife('show -z /environments/x.json').should_fail "ERROR: /environments/x.json: No such file or directory\n"
+ end
+
+ it 'knife show -z /nodes/x.json fails with an error' do
+ knife('show -z /nodes/x.json').should_fail "ERROR: /nodes/x.json: No such file or directory\n"
+ end
+
+ it 'knife show -z /roles/x.json fails with an error' do
+ knife('show -z /roles/x.json').should_fail "ERROR: /roles/x.json: No such file or directory\n"
+ end
+
+ it 'knife show -z /users/x.json fails with an error' do
+ knife('show -z /users/x.json').should_fail "ERROR: /users/x.json: No such file or directory\n"
+ end
+ end
+
+ context 'PUT /TYPE/NAME' do
+ file 'empty.json', {}
+
+ it 'knife raw -z -i empty.json -m PUT /clients/x fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /clients/x").should_fail /404/
+ end
+
+ it 'knife raw -z -i empty.json -m PUT /data/x/y fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /data/x/y").should_fail /404/
+ end
+
+ it 'knife raw -z -i empty.json -m PUT /environments/x fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /environments/x").should_fail /404/
+ end
+
+ it 'knife raw -z -i empty.json -m PUT /nodes/x fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /nodes/x").should_fail /404/
+ end
+
+ it 'knife raw -z -i empty.json -m PUT /roles/x fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /roles/x").should_fail /404/
+ end
+
+ it 'knife raw -z -i empty.json -m PUT /users/x fails with 404' do
+ knife("raw -z -i #{path_to('empty.json')} -m PUT /users/x").should_fail /404/
+ end
+ end
end
end