/[pxelator]/lib/PXElator/t/client.t
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Annotation of /lib/PXElator/t/client.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 313 - (hide annotations)
Thu Aug 27 18:59:12 2009 UTC (14 years, 8 months ago) by dpavlin
File MIME type: application/x-troff
File size: 1160 byte(s)
use upper case mac addresses separated by :
1 dpavlin 156 #!/usr/bin/perl
2    
3     use warnings;
4     use strict;
5     use autodie;
6    
7 dpavlin 305 use Test::More tests => 15;
8 dpavlin 156 use Data::Dump qw/dump/;
9 dpavlin 217 use English;
10 dpavlin 156
11     use_ok 'client';
12    
13     my $host = '127.0.0.1';
14 dpavlin 313 my $mac = 'DE:AD:00:00:BE:EF';
15 dpavlin 156
16 dpavlin 217 my $dir = "$server::base_dir/conf/$server::ip";
17     system "sudo chown $UID $dir/ip $dir/mac";
18    
19 dpavlin 156 ok( client::conf( $host => 'test', default => 'default' ), 'conf default' );
20     cmp_ok( client::conf( $host => 'test' ), 'eq', 'default', 'default' );
21     ok( client::conf( $host => 'test' => 'value' ), 'conf set' );
22     cmp_ok( client::conf( $host => 'test' ), 'eq', 'value', 'value' );
23    
24 dpavlin 220 ok( ! client::conf( $host => 'non-existing' ), 'conf non-existing' );
25    
26 dpavlin 217 ok( my $ip = client::next_ip( $mac ), 'next_ip' );
27 dpavlin 168 diag $ip;
28    
29 dpavlin 217 ok( my $ip_from_mac = client::ip_from_mac( $mac ), 'ip_from_mac' );
30     diag $ip_from_mac;
31     cmp_ok( $ip_from_mac, 'eq', $ip );
32 dpavlin 194
33 dpavlin 217 ok( my $mac_from_ip = client::mac_from_ip( $ip ), 'mac_from_ip' );
34     diag $mac_from_ip;
35     cmp_ok( $mac_from_ip, 'eq', $mac );
36 dpavlin 200
37 dpavlin 305 ok( my $conf = client::all_conf( $ip ), 'all_conf' );
38     diag dump $conf;
39    
40 dpavlin 217 diag "cleanup";
41     ok( unlink( $_ ), "unlink $_" ) foreach ( glob("$dir/ip/$host/*"), "$dir/mac/$mac" );
42     ok( rmdir "$dir/ip/$host", 'rmdir' );

Properties

Name Value
svn:executable *

  ViewVC Help
Powered by ViewVC 1.1.26