Fix the network quota tests
These network quota tests were badly broken. I simplified them up a lot so they will require less maintenance. Change-Id: I9738b9283de2e731510f6ed5ff208c075ea48940 Partial-bug: #1665495
This commit is contained in:
@@ -5,6 +5,7 @@
|
|||||||
#
|
#
|
||||||
mkdir -p ~/.config/openstack/
|
mkdir -p ~/.config/openstack/
|
||||||
FILE=~/.config/openstack/clouds.yaml
|
FILE=~/.config/openstack/clouds.yaml
|
||||||
|
export OS_IDENTITY_API_VERSION=3 # force v3 identity
|
||||||
echo 'clouds:' >$FILE
|
echo 'clouds:' >$FILE
|
||||||
echo ' test_cloud:' >>$FILE
|
echo ' test_cloud:' >>$FILE
|
||||||
env | grep OS_ | tr '=' ' ' | while read k v
|
env | grep OS_ | tr '=' ' ' | while read k v
|
||||||
|
|||||||
@@ -10,27 +10,34 @@
|
|||||||
# License for the specific language governing permissions and limitations
|
# License for the specific language governing permissions and limitations
|
||||||
# under the License.
|
# under the License.
|
||||||
|
|
||||||
|
import uuid
|
||||||
|
|
||||||
from openstack.tests.functional import base
|
from openstack.tests.functional import base
|
||||||
|
|
||||||
|
|
||||||
class TestQuota(base.BaseFunctionalTest):
|
class TestQuota(base.BaseFunctionalTest):
|
||||||
|
|
||||||
|
PROJECT_NAME = 'project-' + uuid.uuid4().hex
|
||||||
|
PROJECT = None
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def setUpClass(cls):
|
||||||
|
super(TestQuota, cls).setUpClass()
|
||||||
|
# Need a project to have a quota
|
||||||
|
cls.PROJECT = cls.conn.identity.create_project(name=cls.PROJECT_NAME)
|
||||||
|
|
||||||
|
@classmethod
|
||||||
|
def tearDownClass(cls):
|
||||||
|
cls.conn.identity.delete_project(cls.PROJECT.id)
|
||||||
|
|
||||||
def test_list(self):
|
def test_list(self):
|
||||||
sot = self.conn.network.quotas()
|
qot = self.conn.network.quotas().next()
|
||||||
for qot in sot:
|
self.assertIsNotNone(qot.project_id)
|
||||||
self.assertIn('subnet', qot)
|
self.assertIsNotNone(qot.networks)
|
||||||
self.assertIn('network', qot)
|
|
||||||
self.assertIn('router', qot)
|
|
||||||
self.assertIn('port', qot)
|
|
||||||
self.assertIn('floatingip', qot)
|
|
||||||
self.assertIn('security_group_rule', qot)
|
|
||||||
self.assertIn('security_group', qot)
|
|
||||||
self.assertIn('subnetpool', qot)
|
|
||||||
self.assertIn('rbac_policy', qot)
|
|
||||||
|
|
||||||
def test_set(self):
|
def test_set(self):
|
||||||
attrs = {'network': 123456789}
|
attrs = {'networks': 123456789}
|
||||||
self.conn.network.update_quota(**attrs)
|
project_quota = self.conn.network.quotas().next()
|
||||||
quota_list = self.conn.network.get_quota()
|
self.conn.network.update_quota(project_quota, **attrs)
|
||||||
for quota in quota_list:
|
new_quota = self.conn.network.get_quota(project_quota.project_id)
|
||||||
self.assertIn('123456789', quota)
|
self.assertEqual(123456789, new_quota.networks)
|
||||||
|
|||||||
Reference in New Issue
Block a user