---
p2v/client/test/cmdline_test_params | 1 +
p2v/client/test/cmdline_test_params_bad | 1 +
p2v/client/test/cmdline_test_params_optional | 1 +
p2v/client/test/test_newmain.rb | 23 +++++++++++++++++++++++
4 files changed, 26 insertions(+)
create mode 100644 p2v/client/test/cmdline_test_params
create mode 100644 p2v/client/test/cmdline_test_params_bad
create mode 100644 p2v/client/test/cmdline_test_params_optional
diff --git a/p2v/client/test/cmdline_test_params b/p2v/client/test/cmdline_test_params
new file mode 100644
index 0000000..b48f9d2
--- /dev/null
+++ b/p2v/client/test/cmdline_test_params
@@ -0,0 +1 @@
+BOOT_IMAGE=/vmlinuz-3.9.9-301.fc19.x86_64 root=/dev/mapper/vg_jelly-lv_root ro
rd.lvm.lv=vg_jelly/lv_root rd.md=0 rd.dm=0 SYSFONT=True KEYTABLE=us
rd.lvm.lv=vg_jelly/lv_swap rd.luks.uuid=luks-2a7c6825-76a4-4b85-9eca-ec35bd682553
LANG=en_US.UTF-8 p2v_test=foo rhgb quiet p2v_ip_manual=true p2v_ip_address=192.168.122.233
p2v_ip_prefix=24 p2v_ip_gateway=192.168.122.1 p2v_ip_dns=192.168.122.1
p2v_server_hostname=convertserver p2v_server_username=root p2v_server_password=lalala
p2v_convert_name=bar
diff --git a/p2v/client/test/cmdline_test_params_bad
b/p2v/client/test/cmdline_test_params_bad
new file mode 100644
index 0000000..f2e6d7f
--- /dev/null
+++ b/p2v/client/test/cmdline_test_params_bad
@@ -0,0 +1 @@
+BOOT_IMAGE=/vmlinuz-3.9.9-301.fc19.x86_64 root=/dev/mapper/vg_jelly-lv_root ro
rd.lvm.lv=vg_jelly/lv_root rd.md=0 rd.dm=0 SYSFONT=True KEYTABLE=us
rd.lvm.lv=vg_jelly/lv_swap rd.luks.uuid=luks-2a7c6825-76a4-4b85-9eca-ec35bd682553
LANG=en_US.UTF-8 p2v_test=foo rhgb quiet p2v_ip_manual=true p2v_ip_address=192.168.122.233
p2v_ip_gateway= p2v_ip_dns=192.168.122.1 p2v_server_hostname=convertserver
p2v_server_username=root p2v_convert_name=
diff --git a/p2v/client/test/cmdline_test_params_optional
b/p2v/client/test/cmdline_test_params_optional
new file mode 100644
index 0000000..840aa14
--- /dev/null
+++ b/p2v/client/test/cmdline_test_params_optional
@@ -0,0 +1 @@
+BOOT_IMAGE=/vmlinuz-3.9.9-301.fc19.x86_64 root=/dev/mapper/vg_jelly-lv_root ro
rd.lvm.lv=vg_jelly/lv_root rd.md=0 rd.dm=0 SYSFONT=True KEYTABLE=us
rd.lvm.lv=vg_jelly/lv_swap rd.luks.uuid=luks-2a7c6825-76a4-4b85-9eca-ec35bd682553
LANG=en_US.UTF-8 p2v_test=foo rhgb quiet p2v_ip_manual=true p2v_ip_address=192.168.122.233
p2v_ip_gateway= p2v_ip_dns=192.168.122.1 p2v_server_hostname=convertserver
p2v_server_username=root p2v_server_password=lalala p2v_convert_name=bar
diff --git a/p2v/client/test/test_newmain.rb b/p2v/client/test/test_newmain.rb
index cc07f9a..d4f6905 100644
--- a/p2v/client/test/test_newmain.rb
+++ b/p2v/client/test/test_newmain.rb
@@ -4,6 +4,9 @@ require 'virt-p2v/ui/main'
WD = File.expand_path File.dirname(__FILE__)
CMDLINE_TEST = File.join(WD, "cmdline_test")
CMDLINE_DEFAULT = File.join(WD, "cmdline_default")
+CMDLINE_TEST_PARAMS = File.join(WD, "cmdline_test_params")
+CMDLINE_TEST_PARAMS_BAD = File.join(WD, "cmdline_test_params_bad")
+CMDLINE_TEST_PARAMS_OPTIONAL = File.join(WD, "cmdline_test_params_optional")
class TestNewMainDry < MiniTest::Unit::TestCase
def setup
@@ -26,6 +29,26 @@ class TestNewMainDry < MiniTest::Unit::TestCase
end
end
+class TestNewMainValidateParams < MiniTest::Unit::TestCase
+ def setup
+ @nm = VirtP2V::UI::NewMain.new dry=true
+ end
+
+ def test_validate_params_ok
+ params = @nm.parse_cmdline(CMDLINE_TEST_PARAMS)
+ assert @nm.validate_params(params)
+ end
+
+ def test_validate_params_opt
+ params = @nm.parse_cmdline(CMDLINE_TEST_PARAMS_OPTIONAL)
+ assert @nm.validate_params(params)
+ end
+
+ def test_validate_params_bad
+ params = @nm.parse_cmdline(CMDLINE_TEST_PARAMS_BAD)
+ refute @nm.validate_params(params)
+ end
+end
class TestNewMain < TestNewMainDry
def setup
--
1.8.3.1