diff --git a/traffic_ops/app/lib/API/PhysLocation.pm b/traffic_ops/app/lib/API/PhysLocation.pm index 6b22f31c34..2b401806a2 100644 --- a/traffic_ops/app/lib/API/PhysLocation.pm +++ b/traffic_ops/app/lib/API/PhysLocation.pm @@ -252,7 +252,7 @@ sub create { } } -sub create_for_reg { +sub create_for_region { my $self = shift; my $region_name = $self->param('region_name'); my $params = $self->req->json; diff --git a/traffic_ops/app/t/api/1.1/cachegroup.t b/traffic_ops/app/t/api/1.1/cachegroup.t index 8e2e10eeff..1ccfc7eecb 100644 --- a/traffic_ops/app/t/api/1.1/cachegroup.t +++ b/traffic_ops/app/t/api/1.1/cachegroup.t @@ -43,12 +43,12 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::PORTAL_USER, p => ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.1/cachegroups.json?orderby=name")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/typeName", "EDGE_LOC" ); + ->json_is( "/response/0/type/name", "EDGE_LOC" ); $t->get_ok("/api/1.1/cachegroups/trimmed.json")->status_is(200)->json_is( "/response/0/name", "edge_atl_group" ) ->json_is( "/response/1/name", "edge_cg4" )->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.1/cachegroups.json?orderby=name")->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/0/typeId", "5" ); + ->json_is( "/response/0/type/id", "5" ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); $dbh->disconnect(); diff --git a/traffic_ops/app/t/api/1.1/server.t b/traffic_ops/app/t/api/1.1/server.t index 7e42166410..47e20ee339 100644 --- a/traffic_ops/app/t/api/1.1/server.t +++ b/traffic_ops/app/t/api/1.1/server.t @@ -39,28 +39,28 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok('/api/1.1/servers.json?orderby=id')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) - ->json_is( "/response/1/status", "ONLINE" )->json_is( "/response/1/ipGateway", "127.0.0.2" )->json_is( "/response/1/ip6Gateway", "2345:1234:12:9::1" ) - ->json_is( "/response/1/tcpPort", "80" )->json_is( "/response/1/cachegroup", "mid-northeast-group" ) + ->json_is( "/response/1/status/name", "ONLINE" )->json_is( "/response/1/ipGateway", "127.0.0.2" )->json_is( "/response/1/ip6Gateway", "2345:1234:12:9::1" ) + ->json_is( "/response/1/tcpPort", "80" )->json_is( "/response/1/cachegroup/name", "mid-northeast-group" ) ->json_is( "/response/1/hostName", "atlanta-mid-01" )->json_is( "/response/1/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/1/ipAddress", "127.0.0.2" )->json_is( "/response/1/profile", "MID1" )->json_is( "/response/1/type", "MID" ) - ->json_is( "/response/1/physLocation", "Denver" )->json_is( "/response/1/interfaceName", "bond0" )->json_is( "/response/1/interfaceMtu", "9000" ) + ->json_is( "/response/1/ipAddress", "127.0.0.2" )->json_is( "/response/1/profile/name", "MID1" )->json_is( "/response/1/type/name", "MID" ) + ->json_is( "/response/1/physLocation/name", "Denver" )->json_is( "/response/1/interfaceName", "bond0" )->json_is( "/response/1/interfaceMtu", "9000" ) - ->json_is( "/response/2/status", "ONLINE" )->json_is( "/response/2/ipGateway", "127.0.0.4" )->json_is( "/response/2/ip6Gateway", "2345:1234:12:b::1" ) - ->json_is( "/response/2/tcpPort", "81" )->json_is( "/response/2/cachegroup", "mid-northeast-group" )->json_is( "/response/2/hostName", "rascal01" ) - ->json_is( "/response/2/domainName", "kabletown.net" )->json_is( "/response/2/ipAddress", "127.0.0.4" )->json_is( "/response/2/profile", "RASCAL1" ) - ->json_is( "/response/2/type", "RASCAL" )->json_is( "/response/2/physLocation", "Denver" )->json_is( "/response/2/interfaceName", "bond0" ) + ->json_is( "/response/2/status/name", "ONLINE" )->json_is( "/response/2/ipGateway", "127.0.0.4" )->json_is( "/response/2/ip6Gateway", "2345:1234:12:b::1" ) + ->json_is( "/response/2/tcpPort", "81" )->json_is( "/response/2/cachegroup/name", "mid-northeast-group" )->json_is( "/response/2/hostName", "rascal01" ) + ->json_is( "/response/2/domainName", "kabletown.net" )->json_is( "/response/2/ipAddress", "127.0.0.4" )->json_is( "/response/2/profile/name", "RASCAL1" ) + ->json_is( "/response/2/type/name", "RASCAL" )->json_is( "/response/2/physLocation/name", "Denver" )->json_is( "/response/2/interfaceName", "bond0" ) ->json_is( "/response/2/interfaceMtu", "9000" ) - ->json_is( "/response/4/status", "ONLINE" )->json_is( "/response/4/ipGateway", "127.0.0.6" )->json_is( "/response/4/ip6Gateway", "2345:1234:12:c::1" ) - ->json_is( "/response/4/tcpPort", "81" )->json_is( "/response/4/cachegroup", "mid-northeast-group" )->json_is( "/response/4/hostName", "rascal02" ) - ->json_is( "/response/4/domainName", "kabletown.net" )->json_is( "/response/4/ipAddress", "127.0.0.6" )->json_is( "/response/4/profile", "RASCAL2" ) - ->json_is( "/response/4/type", "RASCAL" )->json_is( "/response/4/physLocation", "Denver" )->json_is( "/response/4/interfaceName", "bond0" ) + ->json_is( "/response/4/status/name", "ONLINE" )->json_is( "/response/4/ipGateway", "127.0.0.6" )->json_is( "/response/4/ip6Gateway", "2345:1234:12:c::1" ) + ->json_is( "/response/4/tcpPort", "81" )->json_is( "/response/4/cachegroup/name", "mid-northeast-group" )->json_is( "/response/4/hostName", "rascal02" ) + ->json_is( "/response/4/domainName", "kabletown.net" )->json_is( "/response/4/ipAddress", "127.0.0.6" )->json_is( "/response/4/profile/name", "RASCAL2" ) + ->json_is( "/response/4/type/name", "RASCAL" )->json_is( "/response/4/physLocation/name", "Denver" )->json_is( "/response/4/interfaceName", "bond0" ) ->json_is( "/response/4/interfaceMtu", "9000" ) - ->json_is( "/response/7/status", "ONLINE" )->json_is( "/response/7/ipGateway", "127.0.0.9" )->json_is( "/response/7/ip6Gateway", "2345:1234:12:f::1" ) - ->json_is( "/response/7/tcpPort", "8088" )->json_is( "/response/7/cachegroup", "mid-northeast-group" )->json_is( "/response/7/hostName", "riak02" ) - ->json_is( "/response/7/domainName", "kabletown.net" )->json_is( "/response/7/ipAddress", "127.0.0.9" )->json_is( "/response/7/profile", "RIAK1" ) - ->json_is( "/response/7/type", "RIAK" )->json_is( "/response/7/physLocation", "Boulder" )->json_is( "/response/7/interfaceName", "eth1" ) + ->json_is( "/response/7/status/name", "ONLINE" )->json_is( "/response/7/ipGateway", "127.0.0.9" )->json_is( "/response/7/ip6Gateway", "2345:1234:12:f::1" ) + ->json_is( "/response/7/tcpPort", "8088" )->json_is( "/response/7/cachegroup/name", "mid-northeast-group" )->json_is( "/response/7/hostName", "riak02" ) + ->json_is( "/response/7/domainName", "kabletown.net" )->json_is( "/response/7/ipAddress", "127.0.0.9" )->json_is( "/response/7/profile/name", "RIAK1" ) + ->json_is( "/response/7/type/name", "RIAK" )->json_is( "/response/7/physLocation/name", "Boulder" )->json_is( "/response/7/interfaceName", "eth1" ) ->json_is( "/response/7/interfaceMtu", "1500" ); $t->get_ok('/api/1.1/servers/hostname/atlanta-edge-01/details.json')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) diff --git a/traffic_ops/app/t/api/1.2/asn.t b/traffic_ops/app/t/api/1.2/asn.t index 2232a3acbf..58eac1e596 100644 --- a/traffic_ops/app/t/api/1.2/asn.t +++ b/traffic_ops/app/t/api/1.2/asn.t @@ -40,15 +40,15 @@ Test::TestHelper->load_core_data($schema); ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => Test::TestHelper::ADMIN_USER_PASSWORD } )->status_is(302) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); -$t->get_ok("/api/1.2/asns.json")->status_is(200)->json_is( "/response/0/id", "1" )->json_is( "/response/0/cachegroup", "mid-northeast-group" ) +$t->get_ok("/api/1.2/asns.json")->status_is(200)->json_is( "/response/0/id", "1" )->json_is( "/response/0/cachegroup/name", "mid-northeast-group" ) ->json_is( "/response/0/asn", "9939" )->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.2/asns.json?orderby=id")->status_is(200)->json_is( "/response/0/id", "1" ) - ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" ) + ->json_is( "/response/0/cachegroup/name", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); $t->get_ok("/api/1.2/asns.json?orderby=cachegroup")->status_is(200)->json_is( "/response/0/id", "1" ) - ->json_is( "/response/0/cachegroup", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" ) + ->json_is( "/response/0/cachegroup/name", "mid-northeast-group" )->json_is( "/response/0/asn", "9939" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } ); diff --git a/traffic_ops/app/t/api/1.2/region.t b/traffic_ops/app/t/api/1.2/region.t index 213168e85f..e223e332c0 100644 --- a/traffic_ops/app/t/api/1.2/region.t +++ b/traffic_ops/app/t/api/1.2/region.t @@ -41,7 +41,7 @@ ok $t->post_ok( '/login', => form => { u => Test::TestHelper::ADMIN_USER, p => T ok $t->post_ok('/api/1.2/divisions/mountain/regions' => {Accept => 'application/json'} => json => { "name" => "region1"})->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/name" => "region1" ) - ->json_is( "/response/divisionName" => "mountain" ) + ->json_is( "/response/division/name" => "mountain" ) , 'Does the region details return?'; ok $t->post_ok('/api/1.2/divisions/mountain/regions' => {Accept => 'application/json'} => json => { "name" => "region1"})->status_is(400); diff --git a/traffic_ops/app/t/api/1.2/server.t b/traffic_ops/app/t/api/1.2/server.t index 60675e1663..25d330c63d 100644 --- a/traffic_ops/app/t/api/1.2/server.t +++ b/traffic_ops/app/t/api/1.2/server.t @@ -53,14 +53,14 @@ ok $t->get_ok('/api/1.2/servers/details.json?orderby=hostName')->status_is(400)- ok $t->get_ok('/api/1.2/servers?type=MID')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-mid-01" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/0/type", "MID" ) + ->json_is( "/response/0/type/name", "MID" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->get_ok('/api/1.2/servers?type=MID&status=ONLINE')->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } ) ->json_is( "/response/0/hostName", "atlanta-mid-01" ) ->json_is( "/response/0/domainName", "ga.atlanta.kabletown.net" ) - ->json_is( "/response/0/type", "MID" ) - ->json_is( "/response/0/status", "ONLINE" ) + ->json_is( "/response/0/type/name", "MID" ) + ->json_is( "/response/0/status/name", "ONLINE" ) ->or( sub { diag $t->tx->res->content->asset->{content}; } ); ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => {