From 46e5f4431c95159c8fb43cf5b03a50c170a86682 Mon Sep 17 00:00:00 2001 From: Gerhard Jungwirth Date: Wed, 19 Mar 2014 18:10:19 +0100 Subject: [PATCH] MT#6195 api tests adjustments - use is --- t/api-billingfees.t | 18 +++++++++--------- t/api-billingprofiles.t | 16 ++++++++-------- t/api-contracts.t | 20 ++++++++++---------- t/api-customercontacts.t | 12 ++++++------ t/api-customers.t | 22 +++++++++++----------- t/api-resellers.t | 24 ++++++++++++------------ t/api-rewriterulesets.t | 4 ++-- t/api-systemcontacts.t | 8 ++++---- 8 files changed, 62 insertions(+), 62 deletions(-) diff --git a/t/api-billingfees.t b/t/api-billingfees.t index a58f844cc6..8af3d6c06d 100644 --- a/t/api-billingfees.t +++ b/t/api-billingfees.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/billingfees/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-billingfees", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-billingfees", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -119,7 +119,7 @@ my @allfees = (); $res = $ua->request($req); is($res->code, 422, "create profile without billing_profile_id"); my $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'billing_profile_id'/, "check error message in body"); # try to create fee with invalid billing_profile_id @@ -142,7 +142,7 @@ my @allfees = (); $res = $ua->request($req); is($res->code, 422, "create profile with invalid billing_profile_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'billing_profile_id'/, "check error message in body"); # try to create fee with missing billing_zone_id @@ -165,7 +165,7 @@ my @allfees = (); $res = $ua->request($req); is($res->code, 422, "create profile without billing_zone_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='billing_zone_id'/, "check error message in body"); # try to create fee with invalid billing_zone_id @@ -188,7 +188,7 @@ my @allfees = (); $res = $ua->request($req); is($res->code, 422, "create profile without billing_profile_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'billing_zone_id'/, "check error message in body"); # TODO: check for wrong values in rates, prepaid etc @@ -200,7 +200,7 @@ my @allfees = (); is($res->code, 200, "fetch fees page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -399,9 +399,9 @@ my @allfees = (); $res = $ua->request($req); is($res->code, 200, "check patched fee item"); my $mod_fee = JSON::from_json($res->decoded_content); - ok($mod_fee->{direction} eq "in", "check patched replace op"); - ok($mod_fee->{_links}->{self}->{href} eq $firstfee, "check patched self link"); - ok($mod_fee->{_links}->{collection}->{href} eq '/api/billingfees/', "check patched collection link"); + is($mod_fee->{direction}, "in", "check patched replace op"); + is($mod_fee->{_links}->{self}->{href}, $firstfee, "check patched self link"); + is($mod_fee->{_links}->{collection}->{href}, '/api/billingfees/', "check patched collection link"); $req->content(JSON::to_json( [ { op => 'replace', path => '/billing_profile_id', value => undef } ] diff --git a/t/api-billingprofiles.t b/t/api-billingprofiles.t index a3a8b6de02..7ac58c3e9c 100644 --- a/t/api-billingprofiles.t +++ b/t/api-billingprofiles.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/billingprofiles/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-billingprofiles", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-billingprofiles", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -69,7 +69,7 @@ my @allprofiles = (); $res = $ua->request($req); is($res->code, 422, "create profile without reseller_id"); my $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='reseller_id'/, "check error message in body"); # try to create profile with empty reseller_id @@ -81,7 +81,7 @@ my @allprofiles = (); $res = $ua->request($req); is($res->code, 422, "create profile with empty reseller_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='reseller_id'/, "check error message in body"); # try to create profile with invalid reseller_id @@ -93,7 +93,7 @@ my @allprofiles = (); $res = $ua->request($req); is($res->code, 422, "create profile with invalid reseller_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'reseller_id'/, "check error message in body"); # TODO: check for wrong values in prepaid, fees etc @@ -105,7 +105,7 @@ my @allprofiles = (); is($res->code, 200, "fetch profile page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -240,9 +240,9 @@ my @allprofiles = (); $res = $ua->request($req); is($res->code, 200, "check patched profile item"); my $mod_profile = JSON::from_json($res->decoded_content); - ok($mod_profile->{name} eq "patched name $t", "check patched replace op"); - ok($mod_profile->{_links}->{self}->{href} eq $firstprofile, "check patched self link"); - ok($mod_profile->{_links}->{collection}->{href} eq '/api/billingprofiles/', "check patched collection link"); + is($mod_profile->{name}, "patched name $t", "check patched replace op"); + is($mod_profile->{_links}->{self}->{href}, $firstprofile, "check patched self link"); + is($mod_profile->{_links}->{collection}->{href}, '/api/billingprofiles/', "check patched collection link"); $req->content(JSON::to_json( diff --git a/t/api-contracts.t b/t/api-contracts.t index 93d7dba08b..2fd7c34295 100644 --- a/t/api-contracts.t +++ b/t/api-contracts.t @@ -28,7 +28,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/contracts/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-contracts", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-contracts", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -107,7 +107,7 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 422, "create contract with invalid type"); my $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'type'/, "check error message in body"); # try to create invalid contract with wrong billing profile @@ -120,7 +120,7 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 422, "create contract with invalid billing profile"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'billing_profile_id'/, "check error message in body"); # try to create invalid contract with customercontact @@ -133,7 +133,7 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 422, "create contract with invalid contact"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /The contact_id is not a valid ngcp:systemcontacts item/, "check error message in body"); # try to create invalid contract without contact @@ -155,7 +155,7 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 422, "create contract with invalid status"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='status'/, "check error message in body"); # iterate over contracts collection to check next/prev links and status @@ -165,7 +165,7 @@ my @allcontracts = (); is($res->code, 200, "fetch contacts page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -306,9 +306,9 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 200, "check patched contract item"); my $mod_contact = JSON::from_json($res->decoded_content); - ok($mod_contact->{status} eq "pending", "check patched replace op"); - ok($mod_contact->{_links}->{self}->{href} eq $firstcontract, "check patched self link"); - ok($mod_contact->{_links}->{collection}->{href} eq '/api/contracts/', "check patched collection link"); + is($mod_contact->{status}, "pending", "check patched replace op"); + is($mod_contact->{_links}->{self}->{href}, $firstcontract, "check patched self link"); + is($mod_contact->{_links}->{collection}->{href}, '/api/contracts/', "check patched collection link"); $req->content(JSON::to_json( @@ -366,7 +366,7 @@ my @allcontracts = (); $res = $ua->request($req); is($res->code, 200, "check termination of contract"); $pc = JSON::from_json($res->decoded_content); - ok($pc->{status} eq "terminated", "check termination status of contract"); + is($pc->{status}, "terminated", "check termination status of contract"); } # check if we can still get the terminated contract diff --git a/t/api-customercontacts.t b/t/api-customercontacts.t index eaf0fd3f53..c1b99aeeff 100644 --- a/t/api-customercontacts.t +++ b/t/api-customercontacts.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/customercontacts/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-customercontacts", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-customercontacts", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -82,7 +82,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 422, "create invalid test contact with missing email"); my $email_err = JSON::from_json($res->decoded_content); - ok($email_err->{code} eq "422", "check error code in body"); + is($email_err->{code}, "422", "check error code in body"); ok($email_err->{message} =~ /field=\'email\'/, "check error message in body"); # try to create invalid contact without reseller_id $req->content(JSON::to_json({ @@ -94,7 +94,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 422, "create invalid test contact with missing reseller_id"); $email_err = JSON::from_json($res->decoded_content); - ok($email_err->{code} eq "422", "check error code in body"); + is($email_err->{code}, "422", "check error code in body"); ok($email_err->{message} =~ /field=\'reseller_id\'/, "check error message in body"); # try to create invalid contact with invalid reseller_id @@ -107,7 +107,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 422, "create invalid test contact with invalid reseller_id"); $email_err = JSON::from_json($res->decoded_content); - ok($email_err->{code} eq "422", "check error code in body"); + is($email_err->{code}, "422", "check error code in body"); ok($email_err->{message} =~ /Invalid \'reseller_id\'/, "check error message in body"); # iterate over contacts collection to check next/prev links @@ -117,7 +117,7 @@ my @allcontacts = (); is($res->code, 200, "fetch contacts page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -238,7 +238,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 200, "check patched contact item"); my $mod_contact = JSON::from_json($res->decoded_content); - ok($mod_contact->{firstname} eq "patchedfirst", "check patched replace op"); + is($mod_contact->{firstname}, "patchedfirst", "check patched replace op"); $req->content(JSON::to_json( [ { op => 'replace', path => '/firstname', value => undef } ] diff --git a/t/api-customers.t b/t/api-customers.t index 24bfadff7c..152b493fe7 100644 --- a/t/api-customers.t +++ b/t/api-customers.t @@ -28,7 +28,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/customers/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-customers", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-customers", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -117,7 +117,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 422, "create customer with invalid type"); my $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'type'/, "check error message in body"); # try to create invalid customer with wrong billing profile @@ -132,7 +132,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 422, "create customer with invalid billing profile"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /Invalid 'billing_profile_id'/, "check error message in body"); # try to create invalid customer with systemcontact @@ -147,7 +147,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 422, "create customer with invalid contact"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /The contact_id is not a valid ngcp:customercontacts item/, "check error message in body"); # try to create invalid customer without contact @@ -173,7 +173,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 422, "create customer with invalid status"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='status'/, "check error message in body"); # try to create invalid customer with invalid max_subscribers @@ -188,7 +188,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 422, "create customer with invalid max_subscribers"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='max_subscribers'/, "check error message in body"); # iterate over customers collection to check next/prev links and status @@ -198,7 +198,7 @@ my @allcustomers = (); is($res->code, 200, "fetch contacts page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -340,9 +340,9 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 200, "check patched customer item"); my $mod_contact = JSON::from_json($res->decoded_content); - ok($mod_contact->{status} eq "pending", "check patched replace op"); - ok($mod_contact->{_links}->{self}->{href} eq $firstcustomer, "check patched self link"); - ok($mod_contact->{_links}->{collection}->{href} eq '/api/customers/', "check patched collection link"); + is($mod_contact->{status}, "pending", "check patched replace op"); + is($mod_contact->{_links}->{self}->{href}, $firstcustomer, "check patched self link"); + is($mod_contact->{_links}->{collection}->{href}, '/api/customers/', "check patched collection link"); $req->content(JSON::to_json( @@ -406,7 +406,7 @@ my @allcustomers = (); $res = $ua->request($req); is($res->code, 200, "check termination of customer"); $pc = JSON::from_json($res->decoded_content); - ok($pc->{status} eq "terminated", "check termination status of customer"); + is($pc->{status}, "terminated", "check termination status of customer"); } # check if we can still get the terminated customer diff --git a/t/api-resellers.t b/t/api-resellers.t index 717a200889..397246a810 100644 --- a/t/api-resellers.t +++ b/t/api-resellers.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/resellers/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-resellers", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-resellers", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -116,7 +116,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller without contract_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='contract_id'/, "check error message in body"); # try to create reseller with empty contract_id @@ -128,7 +128,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with empty contract_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='contract_id'/, "check error message in body"); # try to create reseller with existing contract_id @@ -140,7 +140,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with existing contract_id"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /reseller with this contract already exists/, "check error message in body"); # try to create reseller with existing name @@ -152,7 +152,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with existing name"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /reseller with this name already exists/, "check error message in body"); # try to create reseller with missing name @@ -163,7 +163,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with missing name"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='name'/, "check error message in body"); # try to create reseller with missing status @@ -174,7 +174,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with invalid status"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='status'/, "check error message in body"); # try to create reseller with invalid status @@ -186,7 +186,7 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 422, "create reseller with invalid status"); $err = JSON::from_json($res->decoded_content); - ok($err->{code} eq "422", "check error code in body"); + is($err->{code}, "422", "check error code in body"); ok($err->{message} =~ /field='status'/, "check error message in body"); # iterate over collection to check next/prev links and status @@ -196,7 +196,7 @@ my @allresellers = (); is($res->code, 200, "fetch reseller page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -328,9 +328,9 @@ my @allresellers = (); $res = $ua->request($req); is($res->code, 200, "check patched reseller item"); my $mod_reseller = JSON::from_json($res->decoded_content); - ok($mod_reseller->{name} eq "patched name $t", "check patched replace op"); - ok($mod_reseller->{_links}->{self}->{href} eq $firstreseller, "check patched self link"); - ok($mod_reseller->{_links}->{collection}->{href} eq '/api/resellers/', "check patched collection link"); + is($mod_reseller->{name}, "patched name $t", "check patched replace op"); + is($mod_reseller->{_links}->{self}->{href}, $firstreseller, "check patched self link"); + is($mod_reseller->{_links}->{collection}->{href}, '/api/resellers/', "check patched collection link"); $req->content(JSON::to_json( [ { op => 'replace', path => '/contract_id', value => undef } ] diff --git a/t/api-rewriterulesets.t b/t/api-rewriterulesets.t index 7147ad68a7..c0059d65e4 100644 --- a/t/api-rewriterulesets.t +++ b/t/api-rewriterulesets.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/rewriterulesets/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-rewriterulesets", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-rewriterulesets", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -204,7 +204,7 @@ my @allrules = (); is($res->code, 200, "fetch rules page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); diff --git a/t/api-systemcontacts.t b/t/api-systemcontacts.t index f8e960e9af..eb11e3abce 100644 --- a/t/api-systemcontacts.t +++ b/t/api-systemcontacts.t @@ -26,7 +26,7 @@ $ua->ssl_opts( $req = HTTP::Request->new('OPTIONS', $uri.'/api/systemcontacts/'); $res = $ua->request($req); is($res->code, 200, "check options request"); - ok($res->header('Accept-Post') eq "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-systemcontacts", "check Accept-Post header in options response"); + is($res->header('Accept-Post'), "application/hal+json; profile=http://purl.org/sipwise/ngcp-api/#rel-systemcontacts", "check Accept-Post header in options response"); my $opts = JSON::from_json($res->decoded_content); my @hopts = split /\s*,\s*/, $res->header('Allow'); ok(exists $opts->{methods} && ref $opts->{methods} eq "ARRAY", "check for valid 'methods' in body"); @@ -67,7 +67,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 422, "create invalid test contact with missing email"); my $email_err = JSON::from_json($res->decoded_content); - ok($email_err->{code} eq "422", "check error code in body"); + is($email_err->{code}, "422", "check error code in body"); ok($email_err->{message} =~ /field=\'email\'/, "check error message in body"); # iterate over contacts collection to check next/prev links @@ -77,7 +77,7 @@ my @allcontacts = (); is($res->code, 200, "fetch contacts page"); my $collection = JSON::from_json($res->decoded_content); my $selfuri = $uri . $collection->{_links}->{self}->{href}; - ok($selfuri eq $nexturi, "check _links.self.href of collection"); + is($selfuri, $nexturi, "check _links.self.href of collection"); my $colluri = URI->new($selfuri); ok($collection->{total_count} > 0, "check 'total_count' of collection"); @@ -207,7 +207,7 @@ my @allcontacts = (); $res = $ua->request($req); is($res->code, 200, "check patched contact item"); my $mod_contact = JSON::from_json($res->decoded_content); - ok($mod_contact->{firstname} eq "patchedfirst", "check patched replace op"); + is($mod_contact->{firstname}, "patchedfirst", "check patched replace op"); $req->content(JSON::to_json( [ { op => 'replace', path => '/firstname', value => undef } ]