"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "keystone/tests/protection/v3/test_registered_limits.py" between
keystone-16.0.1.tar.gz and keystone-17.0.0.tar.gz

About: OpenStack Keystone (Core Service: Identity) provides an authentication and authorization service for other OpenStack services. Provides a catalog of endpoints for all OpenStack services.
The "Ussuri" series (latest release).

test_registered_limits.py  (keystone-16.0.1):test_registered_limits.py  (keystone-17.0.0)
skipping to change at line 15 skipping to change at line 15
# http://www.apache.org/licenses/LICENSE-2.0 # http://www.apache.org/licenses/LICENSE-2.0
# #
# Unless required by applicable law or agreed to in writing, software # Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# 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 import uuid
from six.moves import http_client import http.client
from keystone.common import provider_api from keystone.common import provider_api
import keystone.conf import keystone.conf
from keystone.tests.common import auth as common_auth from keystone.tests.common import auth as common_auth
from keystone.tests import unit from keystone.tests import unit
from keystone.tests.unit import base_classes from keystone.tests.unit import base_classes
from keystone.tests.unit import ksfixtures from keystone.tests.unit import ksfixtures
CONF = keystone.conf.CONF CONF = keystone.conf.CONF
PROVIDERS = provider_api.ProviderAPIs PROVIDERS = provider_api.ProviderAPIs
skipping to change at line 85 skipping to change at line 85
'registered_limits': [ 'registered_limits': [
unit.new_registered_limit_ref( unit.new_registered_limit_ref(
service_id=service['id'] service_id=service['id']
) )
] ]
} }
with self.test_client() as c: with self.test_client() as c:
c.post( c.post(
'/v3/registered_limits', json=create, headers=self.headers, '/v3/registered_limits', json=create, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_update_registered_limits(self): def test_user_cannot_update_registered_limits(self):
service = PROVIDERS.catalog_api.create_service( service = PROVIDERS.catalog_api.create_service(
uuid.uuid4().hex, unit.new_service_ref() uuid.uuid4().hex, unit.new_service_ref()
) )
registered_limit = unit.new_registered_limit_ref( registered_limit = unit.new_registered_limit_ref(
service_id=service['id'], id=uuid.uuid4().hex service_id=service['id'], id=uuid.uuid4().hex
) )
skipping to change at line 109 skipping to change at line 109
limit_id = limits[0]['id'] limit_id = limits[0]['id']
with self.test_client() as c: with self.test_client() as c:
update = { update = {
'registered_limit': {'default_limit': 5} 'registered_limit': {'default_limit': 5}
} }
c.patch( c.patch(
'/v3/registered_limits/%s' % limit_id, json=update, '/v3/registered_limits/%s' % limit_id, json=update,
headers=self.headers, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
def test_user_cannot_delete_registered_limits(self): def test_user_cannot_delete_registered_limits(self):
service = PROVIDERS.catalog_api.create_service( service = PROVIDERS.catalog_api.create_service(
uuid.uuid4().hex, unit.new_service_ref() uuid.uuid4().hex, unit.new_service_ref()
) )
registered_limit = unit.new_registered_limit_ref( registered_limit = unit.new_registered_limit_ref(
service_id=service['id'], id=uuid.uuid4().hex service_id=service['id'], id=uuid.uuid4().hex
) )
limits = PROVIDERS.unified_limit_api.create_registered_limits( limits = PROVIDERS.unified_limit_api.create_registered_limits(
[registered_limit] [registered_limit]
) )
limit_id = limits[0]['id'] limit_id = limits[0]['id']
with self.test_client() as c: with self.test_client() as c:
c.delete( c.delete(
'/v3/registered_limits/%s' % limit_id, headers=self.headers, '/v3/registered_limits/%s' % limit_id, headers=self.headers,
expected_status_code=http_client.FORBIDDEN expected_status_code=http.client.FORBIDDEN
) )
class SystemReaderTests(base_classes.TestCaseWithBootstrap, class SystemReaderTests(base_classes.TestCaseWithBootstrap,
common_auth.AuthTestMixin, common_auth.AuthTestMixin,
_UserRegisteredLimitTests): _UserRegisteredLimitTests):
def setUp(self): def setUp(self):
super(SystemReaderTests, self).setUp() super(SystemReaderTests, self).setUp()
self.loadapp() self.loadapp()
self.useFixture(ksfixtures.Policy(self.config_fixture)) self.useFixture(ksfixtures.Policy(self.config_fixture))
self.config_fixture.config(group='oslo_policy', enforce_scope=True) self.config_fixture.config(group='oslo_policy', enforce_scope=True)
 End of changes. 4 change blocks. 
4 lines changed or deleted 4 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)