2014-01-14 21:22:05 +00:00
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
|
|
describe IcecastSecurity do
|
|
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
let(:security) { IcecastSecurity.new }
|
2014-01-16 03:29:52 +00:00
|
|
|
let(:output) { StringIO.new }
|
2014-01-17 04:51:19 +00:00
|
|
|
let(:builder) { ::Builder::XmlMarkup.new(:target => output, :indent => 1) }
|
|
|
|
|
|
|
|
|
|
it "save with chroot" do
|
|
|
|
|
security.change_owner_user ="hotdog"
|
|
|
|
|
security.change_owner_group ="mongrel"
|
2014-01-19 02:20:44 +00:00
|
|
|
security.chroot = 1
|
2014-01-17 04:51:19 +00:00
|
|
|
security.save!
|
|
|
|
|
security.dumpXml(builder)
|
|
|
|
|
|
|
|
|
|
output.rewind
|
|
|
|
|
xml = Nokogiri::XML(output)
|
|
|
|
|
xml.css('security chroot').text.should == '1'
|
|
|
|
|
xml.css('security changeowner user').text.should == 'hotdog'
|
|
|
|
|
xml.css('security changeowner group').text.should == 'mongrel'
|
|
|
|
|
end
|
2014-01-14 21:22:05 +00:00
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
it "save without chroot" do
|
|
|
|
|
security.save!
|
|
|
|
|
security.dumpXml(builder)
|
2014-01-14 21:22:05 +00:00
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
output.rewind
|
2014-01-14 21:22:05 +00:00
|
|
|
|
2014-01-17 04:51:19 +00:00
|
|
|
xml = Nokogiri::XML(output)
|
|
|
|
|
xml.css('security chroot').text.should == '0'
|
|
|
|
|
xml.css('security changeowner').length.should == 0
|
2014-01-14 21:22:05 +00:00
|
|
|
end
|
2014-01-19 02:20:44 +00:00
|
|
|
|
|
|
|
|
describe "poke configs" do
|
|
|
|
|
let(:server) { a = FactoryGirl.create(:icecast_server_with_overrides); a.config_updated; IcecastServer.find(a.id) }
|
|
|
|
|
|
|
|
|
|
it "success via template" do
|
|
|
|
|
server.template.security.save!
|
|
|
|
|
server.reload
|
|
|
|
|
server.config_changed.should == 1
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-21 14:51:03 +00:00
|
|
|
it "delete via template" do
|
|
|
|
|
server.template.security.destroy
|
|
|
|
|
server.reload
|
|
|
|
|
server.config_changed.should == 1
|
|
|
|
|
end
|
|
|
|
|
|
2014-01-19 02:20:44 +00:00
|
|
|
it "success via server" do
|
|
|
|
|
server.security.save!
|
|
|
|
|
server.reload
|
|
|
|
|
server.config_changed.should == 1
|
|
|
|
|
end
|
2014-01-21 14:51:03 +00:00
|
|
|
|
|
|
|
|
it "delete via server" do
|
|
|
|
|
server.security.destroy
|
|
|
|
|
server.reload
|
|
|
|
|
server.config_changed.should == 1
|
|
|
|
|
end
|
2014-01-19 02:20:44 +00:00
|
|
|
end
|
2014-01-14 21:22:05 +00:00
|
|
|
end
|