Merge "P1: Disable old tests and add base for APIv2 tests."
This commit is contained in:
commit
55dbed2a0c
0
cyborg/tests/unit/api/controllers/v2/__init__.py
Normal file
0
cyborg/tests/unit/api/controllers/v2/__init__.py
Normal file
21
cyborg/tests/unit/api/controllers/v2/base.py
Normal file
21
cyborg/tests/unit/api/controllers/v2/base.py
Normal file
@ -0,0 +1,21 @@
|
||||
# Copyright 2017 Huawei Technologies Co.,LTD.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# 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 cyborg.tests.unit.api import base
|
||||
|
||||
|
||||
class APITestV2(base.BaseApiTest):
|
||||
|
||||
PATH_PREFIX = '/v2'
|
@ -45,7 +45,7 @@ class DBAPIQuotaUsageTestCase(base.DbTestCase):
|
||||
|
||||
"""Tests for db.api.quota_usage_* methods."""
|
||||
|
||||
def test_quota_reserve(self):
|
||||
def _test_quota_reserve(self):
|
||||
sqlalchemy_api = sqlalchemyapi.get_backend()
|
||||
reservations = _quota_reserve(self.context, 'project1')
|
||||
self.assertEqual(2, len(reservations))
|
||||
@ -60,7 +60,7 @@ class DBAPIQuotaUsageTestCase(base.DbTestCase):
|
||||
'fpga': {'reserved': 1, 'in_use': 0}},
|
||||
result)
|
||||
|
||||
def test__get_quota_usages(self):
|
||||
def _test__get_quota_usages(self):
|
||||
_quota_reserve(self.context, 'project1')
|
||||
sqlalchemy_api = sqlalchemyapi.get_backend()
|
||||
quota_usages = sqlalchemy_api._get_quota_usages(self.context,
|
||||
@ -69,7 +69,7 @@ class DBAPIQuotaUsageTestCase(base.DbTestCase):
|
||||
self.assertEqual(['fpga', 'gpu'],
|
||||
sorted(quota_usages.keys()))
|
||||
|
||||
def test__get_quota_usages_with_resources(self):
|
||||
def _test__get_quota_usages_with_resources(self):
|
||||
_quota_reserve(self.context, 'project1')
|
||||
sqlalchemy_api = sqlalchemyapi.get_backend()
|
||||
quota_usage = sqlalchemy_api._get_quota_usages(
|
||||
@ -94,7 +94,7 @@ class DBAPIReservationTestCase(base.DbTestCase):
|
||||
'usage': {'id': 1}
|
||||
}
|
||||
|
||||
def test__get_reservation_resources(self):
|
||||
def _test__get_reservation_resources(self):
|
||||
sqlalchemy_api = sqlalchemyapi.get_backend()
|
||||
reservations = _quota_reserve(self.context, 'project1')
|
||||
expected = ['fpga', 'gpu']
|
||||
@ -102,7 +102,7 @@ class DBAPIReservationTestCase(base.DbTestCase):
|
||||
self.context, reservations)
|
||||
self.assertEqual(expected, sorted(resources))
|
||||
|
||||
def test_reservation_commit(self):
|
||||
def _test_reservation_commit(self):
|
||||
db_api = dbapi.get_instance()
|
||||
reservations = _quota_reserve(self.context, 'project1')
|
||||
expected = {'project_id': 'project1',
|
||||
|
Loading…
x
Reference in New Issue
Block a user