From e4d2a22ef623d7c672db15a68fcda7be1dab62dc Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Mon, 7 Apr 2014 12:52:18 +0200 Subject: [PATCH] MT#6295 fix api-root test Update currently available links --- t/api-contracts.t | 2 +- t/api-root.t | 30 +++++++++++++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/t/api-contracts.t b/t/api-contracts.t index 2fd7c34295..9b8eea4538 100644 --- a/t/api-contracts.t +++ b/t/api-contracts.t @@ -162,7 +162,7 @@ my @allcontracts = (); my $nexturi = $uri.'/api/contracts/?page=1&rows=5'; do { $res = $ua->get($nexturi); - is($res->code, 200, "fetch contacts page"); + is($res->code, 200, "fetch contracts page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; is($selfuri, $nexturi, "check _links.self.href of collection"); diff --git a/t/api-root.t b/t/api-root.t index d9b7c74ce7..645a490b52 100644 --- a/t/api-root.t +++ b/t/api-root.t @@ -44,13 +44,33 @@ $ua->ssl_opts( } my @links = $res->header('Link'); - my $rels = { contracts => 1, contacts => 1, }; + my $rels = { contracts => 1, + subscriberpreferences => 1, + subscriberpreferencedefs => 1, + domainpreferencedefs => 1, + billingzones => 1, + systemcontacts => 1, + domains => 1, + billingfees => 1, + rewriterules => 1, + resellers => 1, + rewriterules => 1, + resellers => 1, + rewriterulesets => 1, + customercontacts => 1, + billingprofiles => 1, + customers => 1, + domainpreferences => 1, + subscribers => 1, + }; foreach my $link(@links) { - ok($link =~ /^<\/api\/[a-z]+\/>; rel=\"collection http:\/\/purl\.org\/sipwise\/ngcp-api\/#rel-([a-z]+s)\"$/, "check for valid link syntax"); - ok(exists $rels->{$1}, "check for '$1' collection in Link"); - delete $rels->{$1}; + my $rex = qr/^<\/api\/[a-z]+\/>; rel=\"collection http:\/\/purl\.org\/sipwise\/ngcp-api\/#rel-([a-z]+s)\"$/; + like($link, $rex, "check for valid link syntax"); + my ($relname) = ($link =~ $rex); + ok(exists $rels->{$relname}, "check for '$relname' collection in Link"); + delete $rels->{$relname}; } - ok(keys %{ $rels } == 0, "check if all collections are present in Link"); + is(scalar (keys %{ $rels }), 0, "check if all collections are present in Link"); } done_testing;