You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficcontrol.apache.org by mi...@apache.org on 2017/05/24 02:40:12 UTC
[07/14] incubator-trafficcontrol git commit: Changed parmaeter name
from "capName" to "capability". Added "capability" as a query parameter to
the api_capabilities API as a filter,
and removed the dedicated API Updated the documentation and UT accordingl
Changed parmaeter name from "capName" to "capability".
Added "capability" as a query parameter to the api_capabilities API as a filter, and removed the dedicated API
Updated the documentation and UT accordingly.
Project: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/commit/a9827fdf
Tree: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/tree/a9827fdf
Diff: http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/diff/a9827fdf
Branch: refs/heads/master
Commit: a9827fdf88ad3a8025539c2a92c2e5103f3991ce
Parents: 7fb81cc
Author: naamashoresh <na...@qwilt.com>
Authored: Sun May 21 11:30:32 2017 +0300
Committer: Jeremy Mitchell <mi...@gmail.com>
Committed: Tue May 23 20:39:03 2017 -0600
----------------------------------------------------------------------
.../traffic_ops_api/v12/api_capability.rst | 137 ++++++-------------
.../traffic_ops_api/v12/capability.rst | 24 ++--
traffic_ops/app/lib/API/ApiCapability.pm | 16 +--
traffic_ops/app/t/api/1.2/api_capabilities.t | 54 ++++----
traffic_ops/app/t/api/1.2/capabilities.t | 4 +-
5 files changed, 94 insertions(+), 141 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9827fdf/docs/source/development/traffic_ops_api/v12/api_capability.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/api_capability.rst b/docs/source/development/traffic_ops_api/v12/api_capability.rst
index d1a3b86..1ec1ed8 100644
--- a/docs/source/development/traffic_ops_api/v12/api_capability.rst
+++ b/docs/source/development/traffic_ops_api/v12/api_capability.rst
@@ -31,6 +31,14 @@ API-Capabilities
Role(s) Required: None
+ **Query Parameters**
+
+ +----------------+----------+--------+------------------------------------+
+ | Name | Required | Type | Description |
+ +================+==========+========+====================================+
+ | ``capability`` | no | string | Capability name. |
+ +----------------+----------+--------+------------------------------------+
+
**Response Properties**
+-------------------+--------+--------------------------------------------------+
@@ -42,7 +50,7 @@ API-Capabilities
+-------------------+--------+--------------------------------------------------+
| ``route`` | string | API route. |
+-------------------+--------+--------------------------------------------------+
- | ``capName`` | string | Capability name. |
+ | ``capability`` | string | Capability name. |
+-------------------+--------+--------------------------------------------------+
| ``lastUpdated`` | string | |
+-------------------+--------+--------------------------------------------------+
@@ -55,14 +63,14 @@ API-Capabilities
"id": "6",
"httpMethod": "GET",
"route": "/api/*/asns",
- "capName": "asn-read",
+ "capability": "asn-read",
"lastUpdated": "2017-04-02 08:22:43"
},
{
"id": "7",
"httpMethod": "GET",
"route": "/api/*/asns/*",
- "capName": "asn-read",
+ "capability": "asn-read",
"lastUpdated": "2017-04-02 08:22:43"
}
]
@@ -80,11 +88,11 @@ API-Capabilities
**Request Route Parameters**
- +-------------+----------+---------------------------------------------+
- | Name | Required | Description |
- +=============+==========+=============================================+
- | ``id`` | yes | Mapping id. |
- +-------------+----------+---------------------------------------------+
+ +-------------+----------+-------+-------------------------------------+
+ | Name | Required | Type | Description |
+ +=============+==========+=======+=====================================+
+ | ``id`` | yes | int | Mapping id. |
+ +-------------+----------+-------+-------------------------------------+
**Response Properties**
@@ -97,7 +105,7 @@ API-Capabilities
+-------------------+--------+--------------------------------------------------+
| ``route`` | string | API route. |
+-------------------+--------+--------------------------------------------------+
- | ``capName`` | string | Capability name. |
+ | ``capability`` | string | Capability name. |
+-------------------+--------+--------------------------------------------------+
| ``lastUpdated`` | string | |
+-------------------+--------+--------------------------------------------------+
@@ -110,62 +118,7 @@ API-Capabilities
"id": "6",
"httpMethod": "GET",
"route": "/api/*/asns",
- "capName": "asn-read",
- "lastUpdated": "2017-04-02 08:22:43"
- }
- ]
- }
-
-|
-
-**GET /api/1.2/api_capabilities/capability/:name**
-
- Get all API-capability mappings by capability name.
-
- Authentication Required: Yes
-
- Role(s) Required: None
-
- **Request Route Parameters**
-
- +-------------+----------+---------------------------------------------+
- | Name | Required | Description |
- +=============+==========+=============================================+
- | ``name`` | yes | Capability name. |
- +-------------+----------+---------------------------------------------+
-
- **Response Properties**
-
- +-------------------+--------+--------------------------------------------------+
- | Parameter | Type | Description |
- +===================+========+==================================================+
- | ``id`` | int | Mapping id. |
- +-------------------+--------+--------------------------------------------------+
- | ``httpMethod`` | enum | One of: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'. |
- +-------------------+--------+--------------------------------------------------+
- | ``route`` | string | API route. |
- +-------------------+--------+--------------------------------------------------+
- | ``capName`` | string | Capability name |
- +-------------------+--------+--------------------------------------------------+
- | ``lastUpdated`` | string | |
- +-------------------+--------+--------------------------------------------------+
-
- **Response Example** ::
-
- {
- "response": [
- {
- "id": "6",
- "httpMethod": "GET",
- "route": "/api/*/asns",
- "capName": "asn-read",
- "lastUpdated": "2017-04-02 08:22:43"
- },
- {
- "id": "7",
- "httpMethod": "GET",
- "route": "/api/*/asns/*",
- "capName": "asn-read",
+ "capability": "asn-read",
"lastUpdated": "2017-04-02 08:22:43"
}
]
@@ -181,24 +134,24 @@ API-Capabilities
Role(s) Required: admin or oper
- **Request Parameters**
+ **Request Properties**
- +-------------------+--------+--------------------------------------------------+
- | Parameter | Type | Description |
- +===================+========+==================================================+
- | ``httpMethod`` | enum | One of: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'. |
- +-------------------+--------+--------------------------------------------------+
- | ``route`` | string | API route. |
- +-------------------+--------+--------------------------------------------------+
- | ``capName`` | string | Capability name |
- +-------------------+--------+--------------------------------------------------+
+ +----------------+----------+--------+--------------------------------------------------+
+ | Name | Required | Type | Description |
+ +================+==========+========+==================================================+
+ | ``httpMethod`` | yes | enum | One of: 'GET', 'POST', 'PUT', 'PATCH', 'DELETE'. |
+ +----------------+----------+--------+--------------------------------------------------+
+ | ``route`` | yes | string | API route. |
+ +----------------+----------+--------+--------------------------------------------------+
+ | ``capability`` | yes | string | Capability name |
+ +----------------+----------+--------+--------------------------------------------------+
**Request Example** ::
{
"httpMethod": "POST",
"route": "/api/*/cdns",
- "capName": "cdn-write"
+ "capability": "cdn-write"
}
**Response Properties**
@@ -214,7 +167,7 @@ API-Capabilities
+--------------------+--------+--------------------------------------------------+
| ``>route`` | string | API route. |
+--------------------+--------+--------------------------------------------------+
- | ``>capName`` | string | Capability name |
+ | ``>capability`` | string | Capability name |
+--------------------+--------+--------------------------------------------------+
| ``>lastUpdated`` | string | |
+--------------------+--------+--------------------------------------------------+
@@ -233,7 +186,7 @@ API-Capabilities
"id": "6",
"httpMethod": "POST",
"route": "/api/*/cdns",
- "capName": "cdn-write",
+ "capability": "cdn-write",
"lastUpdated": "2017-04-02 08:22:43"
},
"alerts":[
@@ -256,11 +209,11 @@ API-Capabilities
**Request Route Parameters**
- +-------------------+----------+------------------------------------------------+
- | Name | Type | Description |
- +===================+==========+================================================+
- | ``id`` | yes | Mapping id. |
- +-------------------+----------+------------------------------------------------+
+ +-------------------+----------+--------+---------------------------------------+
+ | Name | Required | Type | Description |
+ +===================+==========+========+=======================================+
+ | ``id`` | yes | string | Mapping id. |
+ +-------------------+----------+--------+---------------------------------------+
**Request Properties**
@@ -271,7 +224,7 @@ API-Capabilities
+-------------------+--------+--------------------------------------------------+
| ``route`` | string | API route. |
+-------------------+--------+--------------------------------------------------+
- | ``capName`` | string | Capability name |
+ | ``capability`` | string | Capability name |
+-------------------+--------+--------------------------------------------------+
@@ -280,7 +233,7 @@ API-Capabilities
{
"httpMethod": "GET",
"route": "/api/*/cdns",
- "capName": "cdn-read"
+ "capability": "cdn-read"
}
**Response Properties**
@@ -296,7 +249,7 @@ API-Capabilities
+--------------------+--------+--------------------------------------------------+
| ``>route`` | string | API route. |
+--------------------+--------+--------------------------------------------------+
- | ``>capName`` | string | Capability name |
+ | ``>capability`` | string | Capability name |
+--------------------+--------+--------------------------------------------------+
| ``>lastUpdated`` | string | |
+--------------------+--------+--------------------------------------------------+
@@ -314,7 +267,7 @@ API-Capabilities
"id": "6",
"httpMethod": "GET",
"route": "/api/*/cdns",
- "capName": "cdn-read",
+ "capability": "cdn-read",
"lastUpdated": "2017-04-02 08:22:43"
},
"alerts":[
@@ -337,11 +290,11 @@ API-Capabilities
**Request Route Parameters**
- +-----------------+----------+------------------------------------------------+
- | Name | Required | Description |
- +=================+==========+================================================+
- | ``id`` | yes | Mapping id. |
- +-----------------+----------+------------------------------------------------+
+ +-------------------+----------+--------+---------------------------------------+
+ | Name | Required | Type | Description |
+ +===================+==========+========+=======================================+
+ | ``id`` | yes | string | Mapping id. |
+ +-------------------+----------+--------+---------------------------------------+
**Response Properties**
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9827fdf/docs/source/development/traffic_ops_api/v12/capability.rst
----------------------------------------------------------------------
diff --git a/docs/source/development/traffic_ops_api/v12/capability.rst b/docs/source/development/traffic_ops_api/v12/capability.rst
index eb3d0f7..e91863e 100644
--- a/docs/source/development/traffic_ops_api/v12/capability.rst
+++ b/docs/source/development/traffic_ops_api/v12/capability.rst
@@ -72,11 +72,11 @@ Capabilities
**Request Route Parameters**
- +-------------+----------+---------------------------------------------+
- | Name | Required | Description |
- +=============+==========+=============================================+
- | ``name`` | yes | Capability name. |
- +-------------+----------+---------------------------------------------+
+ +-------------+----------+--------+------------------------------------+
+ | Name | Required | Type | Description |
+ +=============+==========+========+====================================+
+ | ``name`` | yes | string | Capability name. |
+ +-------------+----------+--------+------------------------------------+
**Response Properties**
@@ -114,13 +114,13 @@ Capabilities
**Request Parameters**
- +-------------------+--------+-------------------------------------------------+
- | Parameter | Type | Description |
- +===================+========+=================================================+
- | ``name`` | string | Capability name. |
- +-------------------+--------+-------------------------------------------------+
- | ``description`` | string | Describing the APIs covered by the capability. |
- +-------------------+--------+-------------------------------------------------+
+ +-----------------+----------+--------+-------------------------------------------------+
+ | Name | Required | Type | Description |
+ +=================+==========+========+=================================================+
+ | ``name`` | yes | string | Capability name. |
+ +-----------------+----------+--------+-------------------------------------------------+
+ | ``description`` | yes | string | Describing the APIs covered by the capability. |
+ +-----------------+----------+--------+-------------------------------------------------+
**Request Example** ::
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9827fdf/traffic_ops/app/lib/API/ApiCapability.pm
----------------------------------------------------------------------
diff --git a/traffic_ops/app/lib/API/ApiCapability.pm b/traffic_ops/app/lib/API/ApiCapability.pm
index 2ee71ab..5686d00 100644
--- a/traffic_ops/app/lib/API/ApiCapability.pm
+++ b/traffic_ops/app/lib/API/ApiCapability.pm
@@ -46,7 +46,7 @@ sub index {
"id" => $row->id,
"httpMethod" => $row->http_method,
"route" => $row->route,
- "capName" => $row->capability->name,
+ "capability" => $row->capability->name,
"lastUpdated" => $row->last_updated
}
);
@@ -66,7 +66,7 @@ sub renderResults {
"id" => $row->id,
"httpMethod" => $row->http_method,
"route" => $row->route,
- "capName" => $row->capability->name,
+ "capability" => $row->capability->name,
"lastUpdated" => $row->last_updated
}
);
@@ -147,7 +147,7 @@ sub create {
my $http_method = $params->{httpMethod} if defined($params->{httpMethod});
my $route = $params->{route} if defined($params->{route});
- my $capability = $params->{capName} if defined($params->{capName});
+ my $capability = $params->{capability} if defined($params->{capability});
my $id = undef;
my ( $is_valid, $errStr ) = $self->is_mapping_valid( $id, $http_method, $route, $capability );
@@ -169,10 +169,10 @@ sub create {
$response->{id} = $rs->id;
$response->{httpMethod} = $rs->http_method;
$response->{route} = $rs->route;
- $response->{capName} = $rs->capability->name;
+ $response->{capability} = $rs->capability->name;
$response->{lastUpdated} = $rs->last_updated;
- &log( $self, "Created API-Capability mapping: '$response->{httpMethod}', '$response->{route}', '$response->{capName}' for id: " . $response->{id}, "APICHANGE" );
+ &log( $self, "Created API-Capability mapping: '$response->{httpMethod}', '$response->{route}', '$response->{capability}' for id: " . $response->{id}, "APICHANGE" );
return $self->success( $response, "API-Capability mapping was created." );
}
@@ -196,7 +196,7 @@ sub update {
my $http_method = $params->{httpMethod} if defined($params->{httpMethod});
my $route = $params->{route} if defined($params->{route});
- my $capability = $params->{capName} if defined($params->{capName});
+ my $capability = $params->{capability} if defined($params->{capability});
my $mapping = $self->db->resultset('ApiCapability')->find( { id => $id } );
if ( !defined($mapping) ) {
@@ -220,10 +220,10 @@ sub update {
$response->{id} = $rs->id;
$response->{httpMethod} = $rs->http_method;
$response->{route} = $rs->route;
- $response->{capName} = $rs->capability->name;
+ $response->{capability} = $rs->capability->name;
$response->{lastUpdated} = $rs->last_updated;
- &log( $self, "Updated API-Capability mapping: '$response->{httpMethod}', '$response->{route}', '$response->{capName}' for id: " . $response->{id}, "APICHANGE" );
+ &log( $self, "Updated API-Capability mapping: '$response->{httpMethod}', '$response->{route}', '$response->{capability}' for id: " . $response->{id}, "APICHANGE" );
return $self->success( $response, "API-Capability mapping was updated." );
}
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9827fdf/traffic_ops/app/t/api/1.2/api_capabilities.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/api_capabilities.t b/traffic_ops/app/t/api/1.2/api_capabilities.t
index 5581bec..5221c03 100644
--- a/traffic_ops/app/t/api/1.2/api_capabilities.t
+++ b/traffic_ops/app/t/api/1.2/api_capabilities.t
@@ -71,12 +71,12 @@ my $http_method = "GET";
my $route = "sample/route";
my $cap_name = "basic-read";
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $cap_name
+ "httpMethod" => $http_method, "route" => $route, "capability" => $cap_name
})->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/response/id" => 1 )
->json_is( "/response/httpMethod" => $http_method )
->json_is( "/response/route" => $route )
- ->json_is( "/response/capName" => $cap_name )
+ ->json_is( "/response/capability" => $cap_name )
, 'Does mapping details return?';
#verifying the create worked
@@ -84,7 +84,7 @@ $t->get_ok("/api/1.2/api_capabilities")->status_is(200)
->json_is( "/response/0/id" => 1 )
->json_is( "/response/0/httpMethod" => $http_method )
->json_is( "/response/0/route" => $route )
- ->json_is( "/response/0/capName" => $cap_name )
+ ->json_is( "/response/0/capability" => $cap_name )
->or( sub { diag $t->tx->res->content->asset->{content}; } );;
#verifying get single
@@ -92,12 +92,12 @@ $t->get_ok("/api/1.2/api_capabilities/1")->status_is(200)
->json_is( "/response/0/id" => 1 )
->json_is( "/response/0/httpMethod" => $http_method )
->json_is( "/response/0/route" => $route )
- ->json_is( "/response/0/capName" => $cap_name )
+ ->json_is( "/response/0/capability" => $cap_name )
->or( sub { diag $t->tx->res->content->asset->{content}; } );;
#insert the same mapping twice - fails
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $cap_name
+ "httpMethod" => $http_method, "route" => $route, "capability" => $cap_name
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "HTTP method \'$http_method\', route \'$route\' are already mapped to capability: $cap_name" )
, 'Is same entry twice?';
@@ -105,12 +105,12 @@ $t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => jso
#edit a mapping
my $cap_name_updated = "cdn-write";
$t->put_ok("/api/1.2/api_capabilities/1" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $cap_name_updated
+ "httpMethod" => $http_method, "route" => $route, "capability" => $cap_name_updated
})->status_is(200)
->json_is( "/response/id" => 1 )
->json_is( "/response/httpMethod" => $http_method )
->json_is( "/response/route" => $route )
- ->json_is( "/response/capName" => $cap_name_updated )
+ ->json_is( "/response/capability" => $cap_name_updated )
, 'Did update succeed?';
#get after update
@@ -118,17 +118,17 @@ $t->get_ok("/api/1.2/api_capabilities/1" => {Accept => 'application/json'} )->st
->json_is( "/response/0/id" => 1 )
->json_is( "/response/0/httpMethod" => $http_method )
->json_is( "/response/0/route" => $route )
- ->json_is( "/response/0/capName" => $cap_name_updated )
+ ->json_is( "/response/0/capability" => $cap_name_updated )
, 'Did get after update succeed?';
#edit the mapping back
$t->put_ok("/api/1.2/api_capabilities/1" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $cap_name
+ "httpMethod" => $http_method, "route" => $route, "capability" => $cap_name
})->status_is(200)
->json_is( "/response/id" => 1 )
->json_is( "/response/httpMethod" => $http_method )
->json_is( "/response/route" => $route )
- ->json_is( "/response/capName" => $cap_name )
+ ->json_is( "/response/capability" => $cap_name )
, 'Did update succeed?';
#get after update
@@ -136,19 +136,19 @@ $t->get_ok("/api/1.2/api_capabilities/1" => {Accept => 'application/json'} )->st
->json_is( "/response/0/id" => 1 )
->json_is( "/response/0/httpMethod" => $http_method )
->json_is( "/response/0/route" => $route )
- ->json_is( "/response/0/capName" => $cap_name )
+ ->json_is( "/response/0/capability" => $cap_name )
, 'Did get after update back succeed?';
#insert another mapping
my $http_method_post = "POST";
my $route_sample2 = "sample/route2";
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method_post, "route" => $route_sample2, "capName" => $cap_name
+ "httpMethod" => $http_method_post, "route" => $route_sample2, "capability" => $cap_name
})->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/response/id" => 2 )
->json_is( "/response/httpMethod" => $http_method_post )
->json_is( "/response/route" => $route_sample2 )
- ->json_is( "/response/capName" => $cap_name )
+ ->json_is( "/response/capability" => $cap_name )
, 'Does mapping details return?';
#get by cap name
@@ -156,11 +156,11 @@ $t->get_ok("/api/1.2/api_capabilities?capability=$cap_name")->status_is(200)
->json_is( "/response/0/id" => 1 )
->json_is( "/response/0/httpMethod" => $http_method )
->json_is( "/response/0/route" => $route )
- ->json_is( "/response/0/capName" => $cap_name )
+ ->json_is( "/response/0/capability" => $cap_name )
->json_is( "/response/1/id" => 2 )
->json_is( "/response/1/httpMethod" => $http_method_post )
->json_is( "/response/1/route" => $route_sample2 )
- ->json_is( "/response/1/capName" => $cap_name )
+ ->json_is( "/response/1/capability" => $cap_name )
->or( sub { diag $t->tx->res->content->asset->{content}; } );;
#test delete
@@ -175,54 +175,54 @@ $t->get_ok("/api/1.2/api_capabilities/2")->status_is(200)->json_is( "/response",
# adding invalid entry - no httpMethod
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "route" => $route, "capName" => $cap_name
+ "route" => $route, "capability" => $cap_name
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "HTTP method is required." )
, 'Was invalid insert (no httpMethod) reject correctly?';
# adding invalid entry - no route
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "capName" => $cap_name
+ "httpMethod" => $http_method, "capability" => $cap_name
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "Route is required." )
, 'Was invalid insert (no route) reject correctly?';
# adding invalid entry - empty route
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "capName" => $cap_name, "route" => ""
+ "httpMethod" => $http_method, "capability" => $cap_name, "route" => ""
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "Route is required." )
, 'Was invalid insert (no route) reject correctly?';
-# adding invalid entry - no capName
+# adding invalid entry - no capability
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
"httpMethod" => $http_method, "route" => $route
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "Capability name is required." )
- , 'Was invalid insert (no capName) reject correctly?';
+ , 'Was invalid insert (no capability) reject correctly?';
-# adding invalid entry - empty capName
+# adding invalid entry - empty capability
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => ""
+ "httpMethod" => $http_method, "route" => $route, "capability" => ""
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "Capability name is required." )
- , 'Was invalid insert (no capName) reject correctly?';
+ , 'Was invalid insert (no capability) reject correctly?';
# adding invalid entry - invalid httpMethod
my $invalid_http_method = 'BAD';
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $invalid_http_method, "route" => $route, "capName" => $cap_name
+ "httpMethod" => $invalid_http_method, "route" => $route, "capability" => $cap_name
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "HTTP method \'$invalid_http_method\' is invalid. Valid values are: DELETE, GET, PATCH, POST, PUT" )
- , 'Was invalid insert (no capName) reject correctly?';
+ , 'Was invalid insert (no capability) reject correctly?';
# adding invalid entry - non-existing capability
my $non_existing_cap = "non-existing";
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $non_existing_cap
+ "httpMethod" => $http_method, "route" => $route, "capability" => $non_existing_cap
})->status_is(400)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/alerts/0/text" => "Capability \'$non_existing_cap\' does not exist." )
- , 'Was invalid insert (no capName) reject correctly?';
+ , 'Was invalid insert (no capability) reject correctly?';
ok $t->get_ok('/logout')->status_is(302)->or( sub { diag $t->tx->res->content->asset->{content}; } );
http://git-wip-us.apache.org/repos/asf/incubator-trafficcontrol/blob/a9827fdf/traffic_ops/app/t/api/1.2/capabilities.t
----------------------------------------------------------------------
diff --git a/traffic_ops/app/t/api/1.2/capabilities.t b/traffic_ops/app/t/api/1.2/capabilities.t
index b1031ef..3219b38 100644
--- a/traffic_ops/app/t/api/1.2/capabilities.t
+++ b/traffic_ops/app/t/api/1.2/capabilities.t
@@ -162,12 +162,12 @@ $t->post_ok("/api/1.2/capabilities" => {Accept => 'application/json'} => json =>
my $http_method = "GET";
my $route = "sample/route";
$t->post_ok("/api/1.2/api_capabilities" => {Accept => 'application/json'} => json => {
- "httpMethod" => $http_method, "route" => $route, "capName" => $cap_name
+ "httpMethod" => $http_method, "route" => $route, "capability" => $cap_name
})->status_is(200)->or( sub { diag $t->tx->res->content->asset->{content};} )
->json_is( "/response/id" => 1 )
->json_is( "/response/httpMethod" => $http_method )
->json_is( "/response/route" => $route )
- ->json_is( "/response/capName" => $cap_name )
+ ->json_is( "/response/capability" => $cap_name )
, 'Does mapping details return?';
#test delete - should fail