diff options
author | Daniel Friesel <derf@finalrewind.org> | 2010-12-04 14:17:58 +0100 |
---|---|---|
committer | Daniel Friesel <derf@finalrewind.org> | 2010-12-04 14:17:58 +0100 |
commit | 404dff939c881a403f7bd7a7c4827cdc476a477a (patch) | |
tree | 7e0234535cd3a366ca3f5ff7581f05137b531f34 /t | |
parent | 0df70e16109308056146065caf9e9009e9308aa2 (diff) |
Fix tests for new POST stuff
Diffstat (limited to 't')
-rw-r--r-- | t/50-www-efa.t | 36 |
1 files changed, 17 insertions, 19 deletions
diff --git a/t/50-www-efa.t b/t/50-www-efa.t index 8e56624..c3d1c31 100644 --- a/t/50-www-efa.t +++ b/t/50-www-efa.t @@ -21,21 +21,6 @@ sub efa_conf { return $ret; } -sub efa_post { - my $ret = { - place_origin => 'Essen', - name_origin => 'HBf', - type_origin => 'stop', - place_destination => 'Koeln', - name_destination => 'HBf', - type_destination => 'stop', - }; - foreach my $p (@_) { - $ret->{$p->[0]} = $p->[1]; - } - return $ret; -} - sub efa_new { return new_ok( 'WWW::Efa' => [%{efa_conf(@_)}] @@ -46,6 +31,8 @@ sub is_efa_post { my ($ck, $cv, @post) = @_; my $efa = efa_new([$ck, $cv]); + my $ok = 1; + is_deeply( $efa->{'config'}, efa_conf([$ck, $cv]), "$ck => $cv: conf ok", @@ -55,10 +42,21 @@ sub is_efa_post { $efa->{'error'}, undef, "$ck => $cv: No error", ); - - is_deeply( - $efa->{'post'}, efa_post(@post), - "$ck => $cv: POST ok", + + foreach my $ref (@post) { + my ($key, $value) = @{$ref}; + if (not defined $efa->{'post'}->{"key"} and + not defined $value) { + next; + } + if ($efa->{'post'}->{"$key"} ne $value) { + $ok = 0; + last; + } + } + ok( + $ok, + "$ck => $cv: POST okay", ); } |