diff --git a/test/sysconfig_test.rb b/test/sysconfig_test.rb index 76ccd8b..b9c44f2 100755 --- a/test/sysconfig_test.rb +++ b/test/sysconfig_test.rb @@ -284,4 +284,39 @@ expect(subject.parse_metadata(input)).to eq expected end end + + describe ".Export" do + it "returns empty array when nothing is changed" do + subject.Import([]) + expect(subject.Export).to eq([]) + end + + it "returns array with modified variables" do + settings = [{ + "sysconfig_key" => "VARIABLE", + "sysconfig_path" => "/etc/sysconfig/test", + "sysconfig_value" => "no" + }] + subject.Import(settings) + + expect(subject.Export).to eq settings + end + + it "exports always in new format" do + old_format = [{ + "sysconfig_key" => "VARIABLE", + "sysconfig_path" => "test", + "sysconfig_value" => "no" + }] + new_format = [{ + "sysconfig_key" => "VARIABLE", + "sysconfig_path" => "/etc/sysconfig/test", + "sysconfig_value" => "no" + }] + subject.Import(old_format) + + expect(subject.Export).to eq new_format + + end + end end diff --git a/testsuite/.gitignore b/testsuite/.gitignore deleted file mode 100644 index 24f1e26..0000000 --- a/testsuite/.gitignore +++ /dev/null @@ -1,11 +0,0 @@ -Makefile -Makefile.in -site.exp -*.sum -*.log -tmp.out* -tmp.err* -tmp.log* -config -run -*.test diff --git a/testsuite/Makefile.am b/testsuite/Makefile.am deleted file mode 100644 index e85fbc8..0000000 --- a/testsuite/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -# -# Makefile.am for .../testsuite -# -# Do not edit this file (Makefile.am) as it will be overwritten! -# - -AUTOMAKE_OPTIONS = dejagnu -EXTRA_DIST = $(wildcard tests/*.out) $(wildcard tests/*.err) $(wildcard tests/*.rb) - -testsuite_prepare = @ydatadir@/testsuite/Makefile.testsuite - -all-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) - -clean-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) clean - -check-local: $(testsuite_prepare) - make -f $(testsuite_prepare) RPMNAME=$(RPMNAME) srcdir=$(srcdir) check - -# EOF diff --git a/testsuite/tests/Set_Export.err b/testsuite/tests/Set_Export.err deleted file mode 100644 index e69de29..0000000 diff --git a/testsuite/tests/Set_Export.out b/testsuite/tests/Set_Export.out deleted file mode 100644 index c448e6d..0000000 --- a/testsuite/tests/Set_Export.out +++ /dev/null @@ -1,6 +0,0 @@ -Return nil -Return [] -Return nil -Return [] -Return nil -Return [$["sysconfig_key":"VARIABLE", "sysconfig_path":"/etc/sysconfig/test", "sysconfig_value":"no"]] diff --git a/testsuite/tests/Set_Export.rb b/testsuite/tests/Set_Export.rb deleted file mode 100644 index ea1f026..0000000 --- a/testsuite/tests/Set_Export.rb +++ /dev/null @@ -1,47 +0,0 @@ -# encoding: utf-8 - -# Sysconfig module - testsuite -# -# Set() and Export() tests -# -# testedfiles: Sysconfig.ycp -# -# $Id$ -# -module Yast - class SetExportClient < Client - def main - Yast.import "Testsuite" - - Yast.import "Pkg" # override packamanager - Yast.import "Sysconfig" - - Testsuite.Test(lambda { Sysconfig.Set(nil) }, [{}, {}, {}], nil) - Testsuite.Test(lambda { Sysconfig.Export }, [{}, {}, {}], nil) - - Testsuite.Test(lambda { Sysconfig.Set([]) }, [{}, {}, {}], nil) - Testsuite.Test(lambda { Sysconfig.Export }, [{}, {}, {}], nil) - - Testsuite.Test(lambda do - Sysconfig.Set( - [ - { - "sysconfig_key" => "VARIABLE", - "sysconfig_path" => "/etc/sysconfig/test", - "sysconfig_value" => "no" - } - ] - ) - end, [ - {}, - {}, - {} - ], nil) - Testsuite.Test(lambda { Sysconfig.Export }, [{}, {}, {}], nil) - - nil - end - end -end - -Yast::SetExportClient.new.main