From b1cdc4fbe444ef3b63f491a1553228f66a81663a Mon Sep 17 00:00:00 2001 From: Rick Bradley Date: Fri, 27 May 2016 16:23:26 -0500 Subject: [PATCH] (WIP) notes for next steps --- spec/vmpooler/api/v1/vm_hostname_spec.rb | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/spec/vmpooler/api/v1/vm_hostname_spec.rb b/spec/vmpooler/api/v1/vm_hostname_spec.rb index d81cfe7..b2de7c0 100644 --- a/spec/vmpooler/api/v1/vm_hostname_spec.rb +++ b/spec/vmpooler/api/v1/vm_hostname_spec.rb @@ -56,18 +56,24 @@ describe Vmpooler::API::V1 do create_vm('testhost') put "#{prefix}/vm/testhost", '{"tags":{"tested_by":"rspec"}}' expect_json(ok = true, http = 200) + + # TODO: test for tag presence end it 'skips empty tags' do create_vm('testhost') put "#{prefix}/vm/testhost", '{"tags":{"tested_by":""}}' expect_json(ok = true, http = 200) + + # TODO: test for tag presence end it 'does not set tags if request body format is invalid' do create_vm('testhost') put "#{prefix}/vm/testhost", '{"tags":{"tested"}}' expect_json(ok = false, http = 400) + + # TODO: ensure that tags were not set end context '(allowed_tags configured)' do @@ -80,6 +86,8 @@ describe Vmpooler::API::V1 do put "#{prefix}/vm/testhost", '{"tags":{"created_by":"rspec","tested_by":"rspec"}}' expect_json(ok = false, http = 400) + + # TODO: ensure that tag was not set end end @@ -89,19 +97,24 @@ describe Vmpooler::API::V1 do # } } # # it 'correctly filters tags' do - # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com") + # app.settings.set :config, { :config => { tagfilter: { 'url' => '(.*)\/' } } } # # put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com/something.html"}}' - # # expect_json(ok = true, http = 200) + # + # # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com") + # + # # TODO: ensure that filtered tags were set # end # # it 'doesn\'t eat tags not matching filter' do - # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com") + # app.settings.set :config, { :config => { tagfilter: { 'url' => '(.*)\/' } } } # # put "#{prefix}/vm/testhost", '{"tags":{"url":"foo.com"}}' - # # expect_json(ok = true, http = 200) + # + # # expect(redis).to receive(:hset).with("vmpooler__vm__testhost", "tag:url", "foo.com") + # # TODO: ensure that filtered tags were set # end # end