Update test
This commit is contained in:
@@ -92,7 +92,7 @@ module Zanzibar
|
|||||||
|
|
||||||
downloaded_secrets = {}
|
downloaded_secrets = {}
|
||||||
remote_secrets.each do |key, secret|
|
remote_secrets.each do |key, secret|
|
||||||
full_path = secret['prefix'] ? File.join(@setting['secret_dir'], secret['prefix']) : @setting['secret_dir']
|
full_path = secret.has_key?('prefix') ? File.join(@settings['secret_dir'], secret['prefix']) : @settings['secret_dir']
|
||||||
downloaded_secrets[key] = download_one_secret(secret['id'],
|
downloaded_secrets[key] = download_one_secret(secret['id'],
|
||||||
secret['label'],
|
secret['label'],
|
||||||
full_path,
|
full_path,
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ settings:
|
|||||||
domain: zanzitest.net
|
domain: zanzitest.net
|
||||||
secret_dir: secrets/
|
secret_dir: secrets/
|
||||||
ignore_ssl: true
|
ignore_ssl: true
|
||||||
secrets:
|
|
||||||
secrets:
|
secrets:
|
||||||
ssh_key:
|
ssh_key:
|
||||||
id: 2345
|
id: 2345
|
||||||
@@ -12,4 +11,4 @@ secrets:
|
|||||||
prefix_ssh_key:
|
prefix_ssh_key:
|
||||||
id: 2345
|
id: 2345
|
||||||
label: Private Key
|
label: Private Key
|
||||||
prefix: ssh
|
prefix: ssh/
|
||||||
|
|||||||
@@ -24,9 +24,12 @@ describe Zanzibar::Cli do
|
|||||||
FakeFS::FileSystem.clone files
|
FakeFS::FileSystem.clone files
|
||||||
|
|
||||||
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
||||||
.to_return(body: AUTH_XML, status: 200).then
|
.to_return({body: AUTH_XML, status: 200}).then
|
||||||
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
.to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
|
||||||
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
.to_return({body: PRIVATE_KEY_XML, status: 200}).then
|
||||||
|
.to_return({body: AUTH_XML, status: 200}).then
|
||||||
|
.to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
|
||||||
|
.to_return({body: PRIVATE_KEY_XML, status: 200})
|
||||||
|
|
||||||
Dir.chdir File.join(source_root, 'spec', 'files')
|
Dir.chdir File.join(source_root, 'spec', 'files')
|
||||||
end
|
end
|
||||||
@@ -70,7 +73,7 @@ describe Zanzibar::Cli do
|
|||||||
|
|
||||||
it 'should not redownload files it already has' do
|
it 'should not redownload files it already has' do
|
||||||
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
||||||
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
|
||||||
|
|
||||||
WebMock.reset!
|
WebMock.reset!
|
||||||
|
|
||||||
@@ -80,16 +83,19 @@ describe Zanzibar::Cli do
|
|||||||
|
|
||||||
it 'should redownload on update action' do
|
it 'should redownload on update action' do
|
||||||
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
expect { subject.bundle }.to output(/Finished downloading secrets/).to_stdout
|
||||||
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
|
||||||
|
|
||||||
WebMock.reset!
|
WebMock.reset!
|
||||||
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
stub_request(:any, 'https://www.zanzitest.net/webservices/sswebservice.asmx')
|
||||||
|
.to_return({body: AUTH_XML, status: 200}).then
|
||||||
|
.to_return({body: SECRET_WITH_KEY_XML, status: 200}).then
|
||||||
|
.to_return({body: PRIVATE_KEY_XML, status: 200}).then
|
||||||
.to_return(body: AUTH_XML, status: 200).then
|
.to_return(body: AUTH_XML, status: 200).then
|
||||||
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
.to_return(body: SECRET_WITH_KEY_XML, status: 200).then
|
||||||
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
.to_return(body: PRIVATE_KEY_XML, status: 200)
|
||||||
|
|
||||||
expect { subject.update }.to output(/Finished downloading secrets/).to_stdout
|
expect { subject.update }.to output(/Finished downloading secrets/).to_stdout
|
||||||
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(3)
|
expect(WebMock).to have_requested(:post, 'https://www.zanzitest.net/webservices/sswebservice.asmx').times(6)
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should reject a malformed Zanzifile' do
|
it 'should reject a malformed Zanzifile' do
|
||||||
|
|||||||
Reference in New Issue
Block a user