diff --git a/test/ftpserver_test.rb b/test/ftpserver_test.rb index 5b543de..85455cc 100644 --- a/test/ftpserver_test.rb +++ b/test/ftpserver_test.rb @@ -67,30 +67,36 @@ def mock_config(config_path, map) } describe "Yast::FtpServer" do + describe ".Modified" do + it "returns false if no modification happens" + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eq false + end + end + describe ".ValueUI" do context "'VerboseLogging' when getting vsftpd settings" do before do Yast::FtpServer.vsftpd_edit = true end - + it "returns default value 'YES' if 'log_ftp_protocol' missing in config file" do mock_config(VS_CONFIG_PATH, VS_SETTINGS) Yast::FtpServer.ReadVSFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "YES" end - + it "returns value from config file 'NO' if 'log_ftp_protocol = NO' in config file" do mock_config(VS_CONFIG_PATH, VS_SETTINGS.merge("log_ftp_protocol" => "NO")) Yast::FtpServer.ReadVSFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "NO" end it "returns value from config file 'YES' if 'log_ftp_protocol = YES' in config file" do mock_config(VS_CONFIG_PATH, VS_SETTINGS.merge("log_ftp_protocol" => "YES")) Yast::FtpServer.ReadVSFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "YES" end end @@ -99,25 +105,25 @@ def mock_config(config_path, map) before do Yast::FtpServer.vsftpd_edit = false end - + it "returns default value 'NO' if config file empty" do mock_config(PURE_CONFIG_PATH, {}) Yast::FtpServer.ReadPUREFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "NO" end it "returns value from config file 'NO' if 'VerboseLog = no' in config file" do mock_config(PURE_CONFIG_PATH, PURE_SETTINGS) Yast::FtpServer.ReadPUREFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "NO" end - + it "returns value from config file 'YES' if 'VerboseLog = yes' in config file" do mock_config(PURE_CONFIG_PATH, PURE_SETTINGS.merge("VerboseLog" => "YES")) Yast::FtpServer.ReadPUREFTPDSettings() - + expect(Yast::FtpServer.ValueUI("VerboseLogging", false)).to eql "YES" end end diff --git a/testsuite/tests/FtpServer.err b/testsuite/tests/FtpServer.err deleted file mode 100644 index e69de29..0000000 diff --git a/testsuite/tests/FtpServer.out b/testsuite/tests/FtpServer.out deleted file mode 100644 index 0cc99a3..0000000 --- a/testsuite/tests/FtpServer.out +++ /dev/null @@ -1,2 +0,0 @@ -Dump FtpServer::Modified -Return false diff --git a/testsuite/tests/FtpServer.rb b/testsuite/tests/FtpServer.rb deleted file mode 100644 index 3836407..0000000 --- a/testsuite/tests/FtpServer.rb +++ /dev/null @@ -1,21 +0,0 @@ -# encoding: utf-8 - -module Yast - class FtpServerClient < Client - def main - # testedfiles: FtpServer.ycp - - Yast.include self, "testsuite.rb" - TESTSUITE_INIT([], nil) - - Yast.import "FtpServer" - - DUMP("FtpServer::Modified") - TEST(lambda { FtpServer.Modified }, [], nil) - - nil - end - end -end - -Yast::FtpServerClient.new.main