From 404dff939c881a403f7bd7a7c4827cdc476a477a Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Sat, 4 Dec 2010 14:17:58 +0100 Subject: Fix tests for new POST stuff --- t/50-www-efa.t | 36 +++++++++++++++++------------------- 1 file 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", ); } -- cgit v1.2.3