tests: dnsexit2: Simplify request check
This commit is contained in:
parent
bd1e42ac6c
commit
e9029b85d5
1 changed files with 17 additions and 22 deletions
|
@ -159,36 +159,31 @@ subtest 'Testing nic_dnsexit2_update with two hostnames, one with a zone and one
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
test_nic_dnsexit2_update(\%config, 'host1.zone.com', 'host2.zone.com');
|
test_nic_dnsexit2_update(\%config, 'host1.zone.com', 'host2.zone.com');
|
||||||
my $expected_data1 = decode_and_sort_array({
|
my @requests = get_requests();
|
||||||
'domain' => 'host1.zone.com',
|
my @got = map(decode_and_sort_array($_->{content}), @requests);
|
||||||
'apikey' => 'testingpassword',
|
my @want = (
|
||||||
'update' => [
|
decode_and_sort_array({
|
||||||
{
|
'domain' => 'host1.zone.com',
|
||||||
|
'apikey' => 'testingpassword',
|
||||||
|
'update' => [{
|
||||||
'type' => 'A',
|
'type' => 'A',
|
||||||
'name' => '',
|
'name' => '',
|
||||||
'content' => '8.8.4.4',
|
'content' => '8.8.4.4',
|
||||||
'ttl' => 5,
|
'ttl' => 5,
|
||||||
}
|
}],
|
||||||
]
|
}),
|
||||||
});
|
decode_and_sort_array({
|
||||||
my $expected_data2 = decode_and_sort_array({
|
'domain' => 'zone.com',
|
||||||
'domain' => 'zone.com',
|
'apikey' => 'testingpassword',
|
||||||
'apikey' => 'testingpassword',
|
'update' => [{
|
||||||
'update' => [
|
|
||||||
{
|
|
||||||
'type' => 'AAAA',
|
'type' => 'AAAA',
|
||||||
'name' => 'host2',
|
'name' => 'host2',
|
||||||
'content' => '2001:4860:4860::8888',
|
'content' => '2001:4860:4860::8888',
|
||||||
'ttl' => 10,
|
'ttl' => 10,
|
||||||
}
|
}],
|
||||||
]
|
}),
|
||||||
});
|
);
|
||||||
my @requests = get_requests();
|
is_deeply(\@got, \@want, 'data is correct');
|
||||||
for my $i (0..1) {
|
|
||||||
my $data = decode_and_sort_array($requests[$i]->{content});
|
|
||||||
is_deeply($data, $expected_data1, 'Data is correct for call host1') if $i == 0;
|
|
||||||
is_deeply($data, $expected_data2, 'Data is correct for call host2') if $i == 1;
|
|
||||||
}
|
|
||||||
reset_test_data();
|
reset_test_data();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue