381 lines
9.4 KiB
PHP
381 lines
9.4 KiB
PHP
<?php
|
|
/**
|
|
* Copyright 2018 OpenStack Foundation
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
**/
|
|
|
|
/**
|
|
* Class OAuth2SummitLocationsApiTest
|
|
*/
|
|
final class OAuth2SummitLocationsApiTest extends ProtectedApiTest
|
|
{
|
|
public function testGetCurrentSummitLocations($summit_id = 23)
|
|
{
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'page' => 1,
|
|
'per_page' => 5,
|
|
'order' => '-order'
|
|
];
|
|
|
|
$headers =
|
|
[
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocations",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitLocationsMetadata($summit_id = 23)
|
|
{
|
|
$params = [
|
|
'id' => $summit_id,
|
|
];
|
|
|
|
$headers =
|
|
[
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getMetadata",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$metadata = json_decode($content);
|
|
$this->assertTrue(!is_null($metadata));
|
|
}
|
|
|
|
public function testGetCurrentSummitLocationsByClassNameVenueORAirport($summit_id = 24)
|
|
{
|
|
$params = [
|
|
'id' => $summit_id,
|
|
'page' => 1,
|
|
'per_page' => 5,
|
|
'filter' => [
|
|
'class_name=='.\models\summit\SummitVenue::ClassName.',class_name=='.\models\summit\SummitAirport::ClassName,
|
|
]
|
|
];
|
|
|
|
$headers =
|
|
[
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
];
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocations",
|
|
$params,
|
|
[],
|
|
[],
|
|
[],
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitVenues()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 'current',
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getVenues",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitHotels()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 'current',
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getHotels",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitAirports()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 'current',
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getAirports",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitExternalLocations()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 'current',
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getExternalLocations",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testGetCurrentSummitLocation()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 'current',
|
|
'location_id' => 25
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocation",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$locations = json_decode($content);
|
|
$this->assertTrue(!is_null($locations));
|
|
}
|
|
|
|
public function testCurrentSummitLocationEventsWithFilter($summit_id = 7)
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => $summit_id,
|
|
'page' => 1,
|
|
'per_page' => 50,
|
|
'location_id' => 52,
|
|
'filter' => array
|
|
(
|
|
'tags=@Nova',
|
|
'speaker=@Todd'
|
|
)
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocationEvents",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$events = json_decode($content);
|
|
$this->assertTrue(!is_null($events));
|
|
}
|
|
|
|
public function testCurrentSummitPublishedLocationEventsWithFilter()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 23,
|
|
'location_id' => 311,
|
|
'filter' => [
|
|
|
|
'start_date>=1451479955'
|
|
]
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocationPublishedEvents",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$events = json_decode($content);
|
|
$this->assertTrue(!is_null($events));
|
|
}
|
|
|
|
public function testCurrentSummitPublishedLocationTBAEvents()
|
|
{
|
|
$params = array
|
|
(
|
|
'id' => 23,
|
|
'location_id' => "tba",
|
|
);
|
|
|
|
$headers = array
|
|
(
|
|
"HTTP_Authorization" => " Bearer " . $this->access_token,
|
|
"CONTENT_TYPE" => "application/json"
|
|
);
|
|
|
|
$response = $this->action
|
|
(
|
|
"GET",
|
|
"OAuth2SummitLocationsApiController@getLocationPublishedEvents",
|
|
$params,
|
|
array(),
|
|
array(),
|
|
array(),
|
|
$headers
|
|
);
|
|
|
|
$content = $response->getContent();
|
|
$this->assertResponseStatus(200);
|
|
|
|
$events = json_decode($content);
|
|
$this->assertTrue(!is_null($events));
|
|
}
|
|
} |