You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by da...@apache.org on 2016/11/21 19:05:32 UTC

[17/40] incubator-trafficcontrol git commit: fixed the cachegroup test case

fixed the cachegroup test case


Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/cf4c0040
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/cf4c0040
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/cf4c0040

Branch: refs/heads/psql-rebase
Commit: cf4c00407b0eea04e2aa8568b96aa631091b246f
Parents: 2c877a8
Author: Dewayne Richardson <de...@apache.org>
Authored: Thu Nov 17 15:18:42 2016 -0700
Committer: Dan Kirkwood <da...@gmail.com>
Committed: Mon Nov 21 12:04:09 2016 -0700

----------------------------------------------------------------------
 traffic_ops/app/t/api/1.2/cachegroup.t | 32 +++++++++++++++++++++++++++--
 1 file changed, 30 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/cf4c0040/traffic_ops/app/t/api/1.2/cachegroup.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/cachegroup.t b/traffic_ops/app/t/api/1.2/cachegroup.t
index ec3d8d9..57d1b19 100644
--- a/traffic_ops/app/t/api/1.2/cachegroup.t
+++ b/traffic_ops/app/t/api/1.2/cachegroup.t
@@ -32,8 +32,19 @@ my $schema = Schema->connect_to_database;
 my $dbh    = Schema->database_handle;
 my $t      = Test::Mojo->new('TrafficOps');
 
+my $schema_values = { schema => $schema, no_transactions => 1 };
 Test::TestHelper->unload_core_data($schema);
-Test::TestHelper->load_core_data($schema);
+Test::TestHelper->load_all_fixtures( Fixtures::Cdn->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Role->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::TmUser->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Status->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Parameter->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Profile->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::ProfileParameter->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Division->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Region->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::PhysLocation->new($schema_values) );
+Test::TestHelper->load_all_fixtures( Fixtures::Type->new($schema_values) );
 
 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}; } ), 'Should login?';
@@ -55,6 +66,23 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} =
             , 'Does the cache group details return?';
 
 ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => {
+        "name" => "mid-northeast-group",
+        "shortName" => "mid-ne-group",
+        "latitude" => "44",
+        "longitude" => "66",
+        "parentCachegroup" => "",
+        "secondaryParentCachegroup" => "",
+        "typeName" => "MID_LOC" })->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content}; } )
+	->json_is( "/response/name" => "mid-northeast-group" )
+    ->json_is( "/response/shortName" => "mid-ne-group")
+    ->json_is( "/response/latitude" => "44")
+    ->json_is( "/response/longitude" => "66")
+    ->json_is( "/response/parentCachegroup" => "")
+    ->json_is( "/response/secondaryParentCachegroup" => "")
+            , 'Does the cache group details return?';
+
+
+ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} => json => {
         "name" => "cache_group_edge",
         "shortName" => "cg_edge",
         "latitude" => "12",
@@ -107,7 +135,7 @@ ok $t->post_ok('/api/1.2/cachegroups/create' => {Accept => 'application/json'} =
 
 ok $t->post_ok('/api/1.2/servers/create' => {Accept => 'application/json'} => json => {
         "hostName" => "tc1_ats2",
-        "domainName" => "my.cisco.com",
+        "domainName" => "my.domain.com",
         "cachegroup" => "mid-northeast-group",
         "cdnName" => "cdn1",
         "interfaceName" => "eth0",