From 7e11b8d8d6e954632990c83d5a787c945ac2796a Mon Sep 17 00:00:00 2001 From: Angelo Naselli Date: Fri, 13 Feb 2015 21:10:41 +0100 Subject: used dbus timedated api for backend (timezone, RTC and time) --- t/04-Shared_TimeZone.t | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 't') diff --git a/t/04-Shared_TimeZone.t b/t/04-Shared_TimeZone.t index 26f9bfc..f11bb2c 100644 --- a/t/04-Shared_TimeZone.t +++ b/t/04-Shared_TimeZone.t @@ -2,6 +2,8 @@ use 5.006; use strict; use warnings FATAL => 'all'; use Test::More; +use Data::Dumper; +use Time::Piece; BEGIN { use_ok( 'AdminPanel::Shared::TimeZone' ) || print "AdminPanel::Shared::TimeZone failed!\n"; @@ -11,9 +13,21 @@ BEGIN { is( $tz->get_timezone_prefix(), '/usr/share/zoneinfo', 'get_timezone_prefix' ); ok (my @l = $tz->getTimeZones(), 'getTimeZones'); ok (my $h = $tz->readConfiguration(), 'readConfiguration'); + diag Dumper($h); ok (my $s = $tz->ntpCurrentServer(), 'currentNTPServer'); diag "ntpCurrentServer got: < " . ($s ? $s : "none") . " >"; ok (my $a = ($tz->isNTPRunning() ? "running" : "not running"), 'isNTPRunning'); diag "isNTPRunning got: < " . $a . " >"; + SKIP: { + #remember to skip the right number of tests + skip "To enable dialog tests set TEST_SET_DBUS", 3, unless $ENV{TEST_SET_DBUS}; + eval {$tz->setLocalRTC(!$h->{UTC})}; + is ($@, "", 'setLocalRTC' ); + eval {$tz->setTimeZone($h->{ZONE})}; + is ($@, "", 'setTimeZone'); + my $t = localtime; + eval {$tz->setTime($t->epoch())}; + is ($@, "", 'setTime'); + } done_testing; -- cgit v1.2.1