aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rwxr-xr-xt/Cobrand.t20
-rw-r--r--t/Cobrands/Mysite/Util.pm10
2 files changed, 25 insertions, 5 deletions
diff --git a/t/Cobrand.t b/t/Cobrand.t
index fab80e3d2..3f2e34fba 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.4 2009-09-02 08:32:23 louise Exp $
+# $Id: Cobrand.t,v 1.5 2009-09-09 15:29:27 louise Exp $
#
use strict;
use warnings;
-use Test::More tests => 11;
+use Test::More tests => 14;
use Test::Exception;
use FindBin;
@@ -58,6 +58,22 @@ sub test_cobrand_page{
}
+sub test_base_url{
+ my $cobrand = 'mysite';
+
+ # should get the result of the page function in the cobrand module if one exists
+ my $base_url = Cobrand::base_url($cobrand);
+ is('mysite.example.com', $base_url, 'base_url returns output from cobrand module');
+
+ # should return the base url from the config if there is no cobrand module
+ $cobrand = 'nosite';
+ $base_url = Cobrand::base_url($cobrand);
+ is(mySociety::Config::get('BASE_URL'), $base_url, 'base_url returns config base url if no cobrand module');
+
+}
+
ok(test_cobrand_handle() == 1, 'Ran all tests for the cobrand_handle function');
ok(test_cobrand_page() == 1, 'Ran all tests for the cobrand_page function');
ok(test_site_restriction() == 1, 'Ran all tests for the site_restriction function');
+ok(test_base_url() == 1, 'Ran all tests for the base url');
+
diff --git a/t/Cobrands/Mysite/Util.pm b/t/Cobrands/Mysite/Util.pm
index 42b920f91..ebefe6336 100644
--- a/t/Cobrands/Mysite/Util.pm
+++ b/t/Cobrands/Mysite/Util.pm
@@ -7,7 +7,7 @@
# Copyright (c) 2009 UK Citizens Online Democracy. All rights reserved.
# Email: louise@mysociety.org. WWW: http://www.mysociety.org
#
-# $Id: Util.pm,v 1.2 2009-08-31 09:49:59 louise Exp $
+# $Id: Util.pm,v 1.3 2009-09-09 15:29:27 louise Exp $
package Cobrands::Mysite::Util;
use Page;
@@ -29,8 +29,12 @@ sub site_restriction{
}
sub page{
- my %params = ();
- return ("A cobrand produced page", %params);
+ my %params = ();
+ return ("A cobrand produced page", %params);
+}
+
+sub base_url{
+ return 'mysite.example.com';
}
1;