Files
python-manilaclient/manilaclient/tests/functional/test_security_services.py
Douglas Viroel 0ca91287ac Fix update share network tests and skip exception issue
After fixing a bug that was allowing share network update when it
shouldn't, the test that validates the share network creation and
update started failing. An additional validation was introduced and
it caused the new bug. This patch fixes the test and make it work
properly.
In addition this patch fixes test classes that are raising a skip
exception inside the setUpClass function and failing due to testtool
issue #272.

Closes-Bug: #1849728
Closes-Bug: #1849377
Related-Bug: #1846836
Co-Author: Carlos Eduardo <ces.eduardo98@gmail.com>
Change-Id: I5b27ee4a9e844ea48dc9324bcf38f5767223717f
2019-10-29 22:41:50 -03:00

75 lines
2.4 KiB
Python

# Copyright 2015 Mirantis Inc.
# 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.
import ddt
from tempest.lib.common.utils import data_utils
from manilaclient.tests.functional import base
@ddt.ddt
class SecurityServiceReadWriteTest(base.BaseTestCase):
def setUp(self):
super(SecurityServiceReadWriteTest, self).setUp()
self.name = data_utils.rand_name('autotest')
self.description = 'fake_description'
self.user = 'fake_user'
self.password = 'fake_password'
self.server = 'fake_server'
self.domain = 'fake_domain'
self.dns_ip = '1.2.3.4'
self.ou = 'fake_ou'
@ddt.data(
{'name': 'test_name'},
{'description': 'test_description'},
{'user': 'test_username'},
{'password': 'test_password'},
{'server': 'test_server'},
{'domain': 'test_domain'},
{'dns_ip': 'test_dns_ip'},
{'ou': 'test_ou'},
{'name': '""'},
{'description': '""'},
{'user': '""'},
{'password': '""'},
{'server': '""'},
{'domain': '""'},
{'dns_ip': '""'},
{'ou': '""'},
)
def test_create_update_security_service(self, ss_data):
expected_data = {
'name': self.name,
'description': self.description,
'user': self.user,
'password': self.password,
'server': self.server,
'domain': self.domain,
'dns_ip': self.dns_ip,
'ou': self.ou,
}
ss = self.create_security_service(**expected_data)
update = self.admin_client.update_security_service(ss['id'], **ss_data)
expected_data.update(ss_data)
for k, v in expected_data.items():
if v == '""':
self.assertEqual('None', update[k])
else:
self.assertEqual(v, update[k])