aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-06-29 13:30:24 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-06-29 13:30:24 +0000
commit6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217 (patch)
tree7e5723a41d828799e9759547bfd72c0133ba297f /t
downloadmga-youri-submit-6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217.tar
mga-youri-submit-6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217.tar.gz
mga-youri-submit-6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217.tar.bz2
mga-youri-submit-6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217.tar.xz
mga-youri-submit-6cbb51a6bf5f4ccfc3388ce39a3bbd5b14a91217.zip
prepare mergeupstream
Diffstat (limited to 't')
-rw-r--r--t/Makefile.am8
-rw-r--r--t/gpghome/pubring.gpgbin0 -> 565 bytes
-rw-r--r--t/gpghome/random_seedbin0 -> 600 bytes
-rw-r--r--t/gpghome/secring.gpgbin0 -> 628 bytes
-rw-r--r--t/gpghome/trustdb.gpgbin0 -> 1280 bytes
-rwxr-xr-xt/install.t51
-rwxr-xr-xt/perlcritic.t32
-rwxr-xr-xt/set.t124
-rwxr-xr-xt/sign.t57
-rwxr-xr-xt/tags.t55
10 files changed, 327 insertions, 0 deletions
diff --git a/t/Makefile.am b/t/Makefile.am
new file mode 100644
index 0000000..0fd009c
--- /dev/null
+++ b/t/Makefile.am
@@ -0,0 +1,8 @@
+TESTS = perlcritic.t \
+ install.t \
+ sign.t \
+ tags.t
+
+TESTS_ENVIRONMENT = perl -I $(top_srcdir)/lib
+
+EXTRA_DIST = $(TESTS) gpghome
diff --git a/t/gpghome/pubring.gpg b/t/gpghome/pubring.gpg
new file mode 100644
index 0000000..fcfc0e3
--- /dev/null
+++ b/t/gpghome/pubring.gpg
Binary files differ
diff --git a/t/gpghome/random_seed b/t/gpghome/random_seed
new file mode 100644
index 0000000..1b0201e
--- /dev/null
+++ b/t/gpghome/random_seed
Binary files differ
diff --git a/t/gpghome/secring.gpg b/t/gpghome/secring.gpg
new file mode 100644
index 0000000..9017e4d
--- /dev/null
+++ b/t/gpghome/secring.gpg
Binary files differ
diff --git a/t/gpghome/trustdb.gpg b/t/gpghome/trustdb.gpg
new file mode 100644
index 0000000..30712a3
--- /dev/null
+++ b/t/gpghome/trustdb.gpg
Binary files differ
diff --git a/t/install.t b/t/install.t
new file mode 100755
index 0000000..69113ff
--- /dev/null
+++ b/t/install.t
@@ -0,0 +1,51 @@
+#!/usr/bin/perl
+# $Id: install.t 1426 2006-12-17 21:00:25Z guillomovitch $
+
+use Test::More tests => 3;
+use Test::Exception;
+use Youri::Repository::Test;
+use Youri::Package::RPM::Generator;
+use Youri::Package::RPM::URPM;
+use Youri::Submit::Action::Install;
+
+my $writable_repository = Youri::Repository::Test->new(perms => '755');
+my $unwritable_repository = Youri::Repository::Test->new(perms => '000');
+
+my $action = Youri::Submit::Action::Install->new(
+ skip => [ 'cheater' ]
+);
+
+dies_ok {
+ $action->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new()->get_source(),
+ ),
+ $unwritable_repository,
+ undef,
+ undef
+ )
+} 'installing in a non-writable directory';
+
+lives_ok {
+ $action->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new(tags => {
+ name => 'cheater',
+ })->get_source(),
+ ),
+ $unwritable_repository,
+ undef,
+ undef
+ )
+} 'installing in a non-writable directory with an exception';
+
+lives_ok {
+ $action->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new()->get_source(),
+ ),
+ $writable_repository,
+ undef,
+ undef
+ )
+} 'installing in a writable directory';
diff --git a/t/perlcritic.t b/t/perlcritic.t
new file mode 100755
index 0000000..e929713
--- /dev/null
+++ b/t/perlcritic.t
@@ -0,0 +1,32 @@
+#!/usr/bin/perl
+# $Id: perlcritic.t 1530 2007-03-08 20:42:13Z guillomovitch $
+
+use strict;
+use warnings;
+use Test::More;
+use File::Basename;
+use File::Spec;
+
+if (!$ENV{TEST_AUTHOR}) {
+ plan(
+ skip_all => 'Author test. Set $ENV{TEST_AUTHOR} to a true value to run.'
+ );
+}
+
+eval {
+ require Test::Perl::Critic;
+};
+
+if ($@) {
+ plan(
+ skip_all => 'Test::Perl::Critic not installed, skipping'
+ );
+}
+
+Test::Perl::Critic->import();
+my $libdir = File::Spec->catdir(
+ dirname($0),
+ File::Spec->updir(),
+ 'lib'
+);
+all_critic_ok($libdir);
diff --git a/t/set.t b/t/set.t
new file mode 100755
index 0000000..ae44e3a
--- /dev/null
+++ b/t/set.t
@@ -0,0 +1,124 @@
+#!/usr/bin/perl
+# $Id: /local/youri/soft/submit/trunk/t/tags.t 3062 2007-06-28T16:21:35.624871Z guillaume $
+
+use Test::More tests => 7;
+use Test::Exception;
+use Youri::Package::RPM::Test;
+use Youri::Submit::Test::Set;
+
+my $test = Youri::Submit::Test::Set->new(
+ skip => [ 'bar' ]
+);
+
+lives_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'noarch'
+ }),
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src',
+ })
+ ]
+ )
+} 'one source and one binary package from the same source succeed';
+
+throws_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src'
+ }),
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'noarch',
+ sourcerpm => 'other-1-1.src.rpm',
+ })
+ ]
+ )
+} qr/not a canonical package set/,
+'one source and one binary packages from different sources fails';
+
+throws_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'noarch'
+ })
+ ]
+ )
+} qr/number of source packages < 1/,
+'just one source binary fails';
+
+throws_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src'
+ })
+ ]
+ )
+} qr/number of binary packages < 1/,
+'just one source binary fails';
+
+throws_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src'
+ }),
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src'
+ }),
+ ]
+ )
+} qr/number of source packages > 1/,
+'two source packages fails';
+
+lives_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'src'
+ }),
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'noarch'
+ }),
+ Youri::Package::RPM::Test->new(tags => {
+ arch => 'noarch'
+ })
+ ]
+ )
+}
+'one source and two binary packages succedd';
+
+lives_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ name => 'bar',
+ release => '1mdk'
+ })
+ ]
+ )
+} 'non-compliant package with exception succeed';
diff --git a/t/sign.t b/t/sign.t
new file mode 100755
index 0000000..db6f619
--- /dev/null
+++ b/t/sign.t
@@ -0,0 +1,57 @@
+#!/usr/bin/perl
+# $Id: sign.t 1407 2006-12-03 12:02:02Z guillomovitch $
+
+use Test::More tests => 3;
+use Test::Exception;
+use File::Basename;
+use Youri::Package::RPM::Generator;
+use Youri::Package::RPM::URPM;
+use Youri::Submit::Action::Sign;
+
+my $action1 = Youri::Submit::Action::Sign->new(
+ name => 'Youri',
+ path => dirname($0) . '/gpghome',
+ passphrase => 'Youri sux',
+ skip => [ 'cheater' ]
+);
+
+dies_ok {
+ $action1->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new()->get_source(),
+ ),
+ undef,
+ undef,
+ undef
+ )
+} 'signing with wrong key';
+
+lives_ok {
+ $action1->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new(tags => {
+ name => 'cheater',
+ })->get_source(),
+ ),
+ undef,
+ undef,
+ undef
+ )
+} 'signing with wrong key using an exception';
+
+my $action2 = Youri::Submit::Action::Sign->new(
+ name => 'Youri',
+ path => dirname($0) . '/gpghome',
+ passphrase => 'Youri rulez',
+);
+
+lives_ok {
+ $action2->run(
+ Youri::Package::RPM::URPM->new(
+ file => Youri::Package::RPM::Generator->new()->get_source(),
+ ),
+ undef,
+ undef,
+ undef
+ )
+} 'signing with correct key';
diff --git a/t/tags.t b/t/tags.t
new file mode 100755
index 0000000..4946799
--- /dev/null
+++ b/t/tags.t
@@ -0,0 +1,55 @@
+#!/usr/bin/perl
+# $Id: tags.t 1687 2007-06-28 22:44:07Z guillomovitch $
+
+use Test::More tests => 3;
+use Test::Exception;
+use Youri::Package::RPM::Test;
+use Youri::Submit::Test::Tag;
+
+my $test = Youri::Submit::Test::Tag->new(
+ tags => { release => 'plf$' },
+ skip => [ 'bar' ]
+);
+
+lives_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ name => 'foo',
+ release => '1plf'
+ })
+ ]
+ )
+} 'compliant package succeed';
+
+throws_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ name => 'foo',
+ release => '1mdk'
+ })
+ ]
+ )
+} qr/invalid value 1mdk for tag release/,
+'non-compliant package fails';
+
+lives_ok {
+ $test->run(
+ undef,
+ undef,
+ undef,
+ [
+ Youri::Package::RPM::Test->new(tags => {
+ name => 'bar',
+ release => '1mdk'
+ })
+ ],
+ )
+} 'non-compliant package with exception succeed';