Files
python-novaclient/novaclient/tests/functional/v2/test_usage.py
Diana Clarke 53b23d5217 Microversion 2.40 - Simple tenant usage pagination
Add optional parameters 'limit' and 'marker' to the
os-simple-tenant-usage endpoints for pagaination.

  /os-simple-tenant-usage?limit={limit}&marker={instance_uuid}
  /os-simple-tenant-usage/{tenant}?limit={limit}&marker={instance_uuid}

Implements blueprint paginate-simple-tenant-usage
Depends-on: Ic8e9f869f1b855f968967bedbf77542f287f26c0
Change-Id: If99db6933de012b71cf2c982075f08b3e664361e
2016-12-19 14:04:13 -05:00

39 lines
1.4 KiB
Python

# 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 novaclient.tests.functional.v2.legacy import test_usage
class TestUsageCLI_V240(test_usage.TestUsageCLI):
COMPUTE_API_VERSION = '2.40'
class TestUsageClient_V240(test_usage.TestUsageClient):
COMPUTE_API_VERSION = '2.40'
def test_get(self):
start, end = self._create_servers_in_time_window()
tenant_id = self._get_project_id(self.cli_clients.tenant_name)
usage = self.client.usage.get(
tenant_id, start=start, end=end, limit=1)
self.assertEqual(tenant_id, usage.tenant_id)
self.assertEqual(1, len(usage.server_usages))
def test_list(self):
start, end = self._create_servers_in_time_window()
usages = self.client.usage.list(
start=start, end=end, detailed=True, limit=1)
self.assertEqual(1, len(usages))
self.assertEqual(1, len(usages[0].server_usages))