Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixes broken tests due to change in response structure and one contro… #49

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion traffic_ops/app/lib/API/PhysLocation.pm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions traffic_ops/app/t/api/1.1/cachegroup.t
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
32 changes: 16 additions & 16 deletions traffic_ops/app/t/api/1.1/server.t
Original file line number Diff line number Diff line change
Expand Up @@ -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}; } )
Expand Down
6 changes: 3 additions & 3 deletions traffic_ops/app/t/api/1.2/asn.t
Original file line number Diff line number Diff line change
Expand Up @@ -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}; } );
Expand Down
2 changes: 1 addition & 1 deletion traffic_ops/app/t/api/1.2/region.t
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 3 additions & 3 deletions traffic_ops/app/t/api/1.2/server.t
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down