summaryrefslogtreecommitdiffstats
path: root/t/04mediacfg.t
diff options
context:
space:
mode:
Diffstat (limited to 't/04mediacfg.t')
-rw-r--r--t/04mediacfg.t29
1 files changed, 29 insertions, 0 deletions
diff --git a/t/04mediacfg.t b/t/04mediacfg.t
new file mode 100644
index 0000000..b5c1237
--- /dev/null
+++ b/t/04mediacfg.t
@@ -0,0 +1,29 @@
+#!/usr/bin/perl
+
+use strict;
+use warnings;
+use Test::More tests => 11;
+
+use MDV::Distribconf::Build;
+use_ok('MDV::Distribconf::MediaCFG');
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'name', 'toto'), 0,
+ "Valid value return no error");
+
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1'), 0,
+ "valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1k'), 0,
+ "valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', '1d'), 1,
+ "non valide size value");
+is(MDV::Distribconf::MediaCFG::_valid_param('foo', 'size', 'coin'), 1,
+ "non valide size value");
+
+my $mdc = MDV::Distribconf::Build->new("testdata/testa");
+
+ok($mdc->load, "Can't load distrib tree");
+
+ok($mdc->check_index_sync('first'), "Check media hdlist sync with rpms, good case");
+ok(!$mdc->check_index_sync('second'), "Check media hdlist sync with rpms, bad case");
+
+ok($mdc->check_media_md5('first_src'), "Check hdlist md5sum validity, good case");
+ok(!$mdc->check_media_md5('second_src'), "Check hdlist md5sum validity, bad case");