aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlouise <louise>2009-08-31 09:56:11 +0000
committerlouise <louise>2009-08-31 09:56:11 +0000
commit4c38928dc294cc5feb8e017693d1db9c7b1188a9 (patch)
tree544a832fe648ca78e5f9a27f0fcf4f1bdb9a7e8f
parentf62012b5445f911835caa6a6fd3a190f9a6a7232 (diff)
Test cleanup
-rwxr-xr-xt/Cobrand.t20
1 files changed, 8 insertions, 12 deletions
diff --git a/t/Cobrand.t b/t/Cobrand.t
index 1e9a0edf0..5d00cfa03 100755
--- a/t/Cobrand.t
+++ b/t/Cobrand.t
@@ -6,12 +6,12 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: Cobrand.t,v 1.2 2009-08-31 09:48:56 louise Exp $
+# $Id: Cobrand.t,v 1.3 2009-08-31 09:56:11 louise Exp $
#
use strict;
use warnings;
-use Test::More tests => 3;
+use Test::More tests => 11;
use Test::Exception;
use FindBin;
@@ -23,29 +23,25 @@ use Cobrand;
use MockQuery;
sub test_site_restriction{
- # should return result of cobrand module site_restriction function
my $q = new MockQuery('mysite');
my ($site_restriction, $site_id) = Cobrand::set_site_restriction($q);
- like($site_restriction, ' and council = 1 ');
- like($site_id, 99);
+ like($site_restriction, qr/ and council = 1 /, 'should return result of cobrand module site_restriction function');
+ ok($site_id == 99, 'should return result of cobrand module site_restriction function');
- # should return '' and zero if no module exists
$q = new MockQuery('nosite');
($site_restriction, $site_id) = Cobrand::set_site_restriction($q);
- like($site_restriction, '');
- like($site_id, 0);
+ ok($site_restriction eq '', 'should return "" and zero if no module exists' );
+ ok($site_id == 0, 'should return "" and zero if no module exists');
}
sub test_cobrand_handle{
- # should get a module handle if Util module exists for cobrand
my $q = new MockQuery('mysite');
my $handle = Cobrand::cobrand_handle($q);
- like($handle->site_name(), 'mysite');
+ like($handle->site_name(), qr/mysite/, 'should get a module handle if Util module exists for cobrand');
- # should return zero if no module exists
$q = new MockQuery('nosite');
$handle = Cobrand::cobrand_handle($q);
- like($handle, 0);
+ ok($handle == 0, 'should return zero if no module exists');
}