almanach/integration_tests/test_api_authentication.py
Nguyen Hung Phuong 90bb67ffb6 Clean imports in code
In some part in the code we import objects.
In the Openstack style guidelines they recommend to import only
modules.

http://docs.openstack.org/developer/hacking/#imports

Change-Id: I58b2dab1a46128893648630edba615e2592040ac
2016-08-25 17:14:29 -04:00

29 lines
1.2 KiB
Python

# Copyright 2016 Internap.
#
# 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.
from hamcrest import assert_that
from hamcrest import equal_to
from base_api_testcase import BaseApiTestCase
class ApiAuthenticationTest(BaseApiTestCase):
def test_list_entities_unauthorized(self):
list_query = "{url}/project/{project}/instances?start={start}&end={end}"
response = self.almanachHelper.get(url=list_query, headers={'Accept': 'application/json'},
project="e455d65807cb4796bd72abecdc8a76ba",
start="2014-02-28 18:50:00.000", end="2014-03-21 22:00:00.000")
assert_that(response.status_code, equal_to(401))