← Back to team overview

mvhub-dev team mailing list archive

[Merge] lp:~reddy22222/mvhub/add_quick_login_tests into lp:mvhub

 

Dan MacNeil has proposed merging lp:~reddy22222/mvhub/add_quick_login_tests into lp:mvhub.

Requested reviews:
  Dan MacNeil (omacneil)


I added two more test files and 4 more tests to get 100% code coverage on MVHub::Utils
-- 
https://code.launchpad.net/~reddy22222/mvhub/add_quick_login_tests/+merge/28937
Your team MVHub Developers is subscribed to branch lp:mvhub.
=== added file 'lib-mvhub/t/Utils/encode_quick_login_id.t'
--- lib-mvhub/t/Utils/encode_quick_login_id.t	1970-01-01 00:00:00 +0000
+++ lib-mvhub/t/Utils/encode_quick_login_id.t	2010-06-30 21:37:27 +0000
@@ -0,0 +1,26 @@
+#!/usr/bin/perl -w
+
+# $Source$
+# $Revision: 1209 $
+
+use strict;
+use warnings;
+
+# EDIT
+use Test::More tests => 2 + 1;    # +1 for NoWarnings
+use Test::NoWarnings;
+
+use MVHub::Utils;
+
+my $test_message;
+my $got      = 1;
+my $expected = 1;
+
+###
+$expected = 12346;
+is( MVHub::Utils::encode_quick_login_id(1), $expected, $test_message );
+
+###
+$test_message = 'dies when called without parameter';
+eval { MVHub::Utils::encode_quick_login_id() };
+ok( defined $@, $test_message );

=== added file 'lib-mvhub/t/Utils/generate_quick_login_url.t'
--- lib-mvhub/t/Utils/generate_quick_login_url.t	1970-01-01 00:00:00 +0000
+++ lib-mvhub/t/Utils/generate_quick_login_url.t	2010-06-30 21:37:27 +0000
@@ -0,0 +1,31 @@
+#!/usr/bin/perl -w
+
+# $Source$
+# $Revision: 1209 $
+
+use strict;
+use warnings;
+use MVHub::Utils qw/generate_quick_login_url/;
+
+use Test::More tests => 3 + 1;    # +1 for NoWarnings
+use Test::NoWarnings;
+
+my $test_message;
+my $got      = 1;
+my $expected = 1;
+
+###
+$test_message = 'agency_id == 1';
+###
+eval { $got = generate_quick_login_url( 'www.example.com', 1 ) };
+$expected = 'http://www.example.com/cgi-bin/mvhub/agency.pl?rm=ql&id=12346';
+is( $got, $expected, $test_message );
+
+eval { $got = generate_quick_login_url( 'another_example.com', 1 ) };
+$expected = 'http://www.example.com/cgi-bin/mvhub/agency.pl?rm=ql&id=12346';
+is( $got, $expected, $test_message );
+
+eval { $got = generate_quick_login_url( 'www.example.com', 2 ) };
+$expected = 'http://www.example.com/cgi-bin/mvhub/agency.pl?rm=ql&id=12346';
+is( $got, $expected, $test_message );
+


Follow ups